Skip to content

fix: testing ci: attempt 2 #26

fix: testing ci: attempt 2

fix: testing ci: attempt 2 #26

Workflow file for this run

name: Update Chrome Extension
on:
push:
branches:
- main
jobs:
release:
permissions:
contents: write
issues: write
pull-requests: write
name: Semantic Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false # Disable default token usage
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'latest'
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 'latest'
- name: Install dependencies
run: pnpm install
- name: Configure Git for semantic-release
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
- name: Run semantic release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm exec semantic-release
build-chrome-extension:
name: Build Chrome Extension Artifact
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout latest commit
uses: actions/checkout@v4
- name: Pull latest changes
run: git pull origin main
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'latest'
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 'latest'
- name: Install dependencies
run: pnpm install
- name: Print version from package.json
run: |
echo "Version: $(jq -r '.version' package.json)"
- name: Build
run: pnpm build
- name: Archive chrome-extension artifact
run: zip -r chrome-extension-${{ github.sha }}.zip dist/*
- name: Upload chrome-extension artifact
uses: actions/upload-artifact@v4
with:
name: chrome-extension
path: chrome-extension-${{ github.sha }}.zip
upload-extension:
name: Upload Extension
runs-on: ubuntu-latest
needs: build-chrome-extension
env:
EXTENSION_ID: ${{ vars.EXTENSION_ID }}
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'latest'
- name: Download bundle artifact
uses: actions/download-artifact@v4
with:
name: chrome-extension
- name: Install webstore CLI
run: npm install -g chrome-webstore-upload-cli
- name: Upload and submit for review
run: |
unzip chrome-extension-${{ github.sha }}.zip -d dist \
&& chrome-webstore-upload upload \
--source dist \
--extension-id ${{ env.EXTENSION_ID }} \
--client-id ${{ secrets.CI_GOOGLE_CLIENT_ID }} \
--client-secret ${{ secrets.CI_GOOGLE_CLIENT_SECRET }} \
--refresh-token ${{ secrets.CI_GOOGLE_REFRESH_TOKEN }} \
&& chrome-webstore-upload publish \
--extension-id ${{ env.EXTENSION_ID }} \
--client-id ${{ secrets.CI_GOOGLE_CLIENT_ID }} \
--client-secret ${{ secrets.CI_GOOGLE_CLIENT_SECRET }} \
--refresh-token ${{ secrets.CI_GOOGLE_REFRESH_TOKEN }}