fix: fix git for semantic-release #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Chrome Extension | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
name: Semantic Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
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: Build and release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: pnpm exec semantic-release | |
build-chrome-extension: | |
name: Build Chrome Extension Artifact | |
runs-on: ubuntu-latest | |
needs: release | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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: 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: | |
- 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 step | |
run: | | |
chrome-webstore-upload upload \ | |
--source chrome-extension-${{ github.sha }}.zip \ | |
--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 }} |