Skip to content

Rename local storage keys + PLG events #62

Rename local storage keys + PLG events

Rename local storage keys + PLG events #62

Workflow file for this run

name: Build Browser Extension ZIP
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repo
- name: Checkout Code
uses: actions/checkout@v3
# Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18.12.0"
# Install pnpm
- name: Install pnpm
run: npm install -g pnpm
# Cache dependencies
- name: Cache pnpm Store
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
# Install dependencies with --prefer-frozen-lockfile
- name: Install Dependencies
run: pnpm install --prefer-frozen-lockfile
# Load environment variables from root .env
- name: Load Root .env
run: |
if [ -f .env ]; then
echo "Loading root .env file..."
cat .env | grep -v '^#' >> $GITHUB_ENV
fi
# Load environment variables from ./packages/wxt/.env
- name: Load ./packages/wxt/.env.production
run: |
if [ -f ./packages/wxt/.env.production ]; then
echo "Loading ./packages/wxt/.env.production file..."
cat ./packages/wxt/.env.production | grep -v '^#' >> $GITHUB_ENV
fi
# Run the Chrome build command from ./packages/wxt/
- name: Build Chrome ZIP
working-directory: ./packages/wxt
run: pnpm zip
# Run the Firefox build command from ./packages/wxt/
- name: Build Firefox ZIP
working-directory: ./packages/wxt
run: pnpm zip:firefox
# Run the Edge build command from ./packages/wxt/
- name: Build Edge ZIP
working-directory: ./packages/wxt
run: pnpm zip:edge
# Debugging: Check if ZIP files are generated
- name: Check Output Directory
run: ls -l ./packages/wxt/.output/*.zip || echo "No ZIP files found in the output directory"
# Debugging: List ZIP files in the output directory
- name: List ZIP Files
run: ls -l ./packages/wxt/.output/*.zip || echo "No ZIP files found to list"
# Move the ZIP files to the root directory without renaming
- name: Move ZIP Files to Root
run: |
mv ./packages/wxt/.output/bluniversal-comments-chrome.zip ./bluniversal-comments-chrome.zip
mv ./packages/wxt/.output/bluniversal-comments-firefox.zip ./bluniversal-comments-firefox.zip
mv ./packages/wxt/.output/bluniversal-comments-edge.zip ./bluniversal-comments-edge.zip
echo "Moved ZIP files to the root directory"
# Debugging: List files in the root directory
- name: Check Root Directory Before Upload
run: ls -l ./ || echo "No files found in the root directory"
# Upload the Chrome ZIP file as a GitHub Release Artifact
- name: Upload Chrome ZIP as Artifact
uses: actions/upload-artifact@v3
with:
name: bluniversal-comments-chrome
path: ./bluniversal-comments-chrome.zip
# Upload the Firefox ZIP file as a GitHub Release Artifact
- name: Upload Firefox ZIP as Artifact
uses: actions/upload-artifact@v3
with:
name: bluniversal-comments-firefox
path: ./bluniversal-comments-firefox.zip
# Upload the Firefox ZIP file as a GitHub Release Artifact
- name: Upload Edge ZIP as Artifact
uses: actions/upload-artifact@v3
with:
name: bluniversal-comments-edge
path: ./bluniversal-comments-edge.zip
# Get the version number
- name: Get Version
id: get-version
run: |
MAJOR=0
MINOR=0
PATCH=$(printf "%03d" $GITHUB_RUN_NUMBER)
VERSION="v${MAJOR}.${MINOR}.${PATCH}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
# Create GitHub Release
- name: Create GitHub Release
id: create-release
if: github.ref == 'refs/heads/main'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get-version.outputs.version }}
release_name: Browser Extension Release ${{ steps.get-version.outputs.version }}
draft: false
prerelease: false
# Upload Chrome ZIP to Release
- name: Upload ZIPs to Release
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./bluniversal-comments-chrome.zip
asset_name: bluniversal-comments-chrome.zip
asset_content_type: application/zip
# Upload Firefox ZIP to Release
- name: Upload Firefox ZIP to Release
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./bluniversal-comments-firefox.zip
asset_name: bluniversal-comments-firefox.zip
asset_content_type: application/zip
# Upload Edge ZIP to Release
- name: Upload Edge ZIP to Release
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./bluniversal-comments-edge.zip
asset_name: bluniversal-comments-edge.zip
asset_content_type: application/zip