Skip to content

feat: add extension icons, return caching, add tooltips #33

feat: add extension icons, return caching, add tooltips

feat: add extension icons, return caching, add tooltips #33

Workflow file for this run

name: Build, Approve, and Release for Chrome and Firefox
on:
push:
branches:
- main
paths:
- 'src/**'
- 'vite.config.ts'
- 'package.json'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: pnpm/action-setup@v4
with:
version: 8
- run: pnpm install
- name: Run tests
run: pnpm run test
- name: Build extensions
run: |
pnpm run build:chrome
pnpm run build:firefox
- name: Archive builds
run: |
cd dist/chrome && zip -r -FS ../../build-chrome.zip . --exclude '*.git*'
cd ../firefox && zip -r -FS ../../build-firefox.zip . --exclude '*.git*'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: extension-builds
path: |
build-chrome.zip
build-firefox.zip
approve:
needs: build
runs-on: ubuntu-latest
permissions:
issues: write
contents: read
steps:
- name: Manual Approval
uses: trstringer/manual-approval@v1
with:
secret: ${{ secrets.GITHUB_TOKEN }}
approvers: Mohamed3on
minimum-approvals: 1
issue-title: 'Approve release of version ${{ github.sha }}'
issue-body: "Please approve this release by commenting '/approve' on this issue."
exclude-workflow-initiator-as-approver: false
release:
needs: approve
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: pnpm/action-setup@v4
with:
version: latest
- run: pnpm install
- name: Configure Git and bump version
id: version
run: |
git config user.name github-actions
git config user.email [email protected]
pnpm run release || true
echo "new_version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
git push --follow-tags origin main || git push origin main
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: extension-builds
- name: Create or update GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
release_params=(v${{ steps.version.outputs.new_version }} --notes-file CHANGELOG.md)
if gh release view "${release_params[0]}" &> /dev/null; then
gh release edit "${release_params[@]}"
else
gh release create "${release_params[@]}"
fi
for asset in build-chrome.zip build-firefox.zip; do
gh release upload "${release_params[0]}" $asset --clobber
done
rollback:
needs: [approve, release]
runs-on: ubuntu-latest
if: failure()
steps:
- uses: actions/checkout@v4
- name: Rollback release
run: |
git reset --hard HEAD~1
git push --force origin main
- name: Delete latest release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
latest_release=$(gh release list --limit 1 | cut -f 1)
gh release delete $latest_release --yes