Release #2
This file contains hidden or 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: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| type: string | |
| description: 'Release version (e.g., 1.0.0)' | |
| required: true | |
| prerelease: | |
| type: boolean | |
| default: false | |
| description: 'Mark as prerelease' | |
| dryRun: | |
| type: boolean | |
| default: false | |
| description: 'Build and zip only, skip release and git push' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| name: Build & Release | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: 'pnpm' | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Validate version | |
| run: | | |
| if ! echo "${{ inputs.version }}" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then | |
| echo "Error: Version must be in semver format (e.g., 1.0.0)" | |
| exit 1 | |
| fi | |
| - name: Configure Git | |
| run: | | |
| git config user.email "github-actions@users.noreply.github.com" | |
| git config user.name "GitHub Actions" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Update version | |
| run: pnpm version ${{ inputs.version }} --no-git-tag-version | |
| - name: Type check | |
| run: pnpm compile | |
| - name: Check formatting | |
| run: pnpm fmt:check | |
| - name: Zip extensions | |
| run: | | |
| pnpm zip | |
| pnpm zip:firefox | |
| - name: Generate changelog | |
| run: pnpm dlx changelogen@latest > CHANGELOG.md | |
| - name: Verify zip files | |
| run: ls -la .output/*-chrome.zip .output/*-firefox.zip | |
| - name: Commit and tag | |
| if: ${{ !inputs.dryRun }} | |
| run: | | |
| git add package.json CHANGELOG.md | |
| git commit -m "chore(release): v${{ inputs.version }}" | |
| git tag v${{ inputs.version }} | |
| git push | |
| git push --tags | |
| - name: Create GitHub Release | |
| if: ${{ !inputs.dryRun }} | |
| run: | | |
| gh release create v${{ inputs.version }} \ | |
| .output/*-chrome.zip \ | |
| .output/*-firefox.zip \ | |
| --title "v${{ inputs.version }}" \ | |
| --notes-file CHANGELOG.md \ | |
| ${{ inputs.prerelease && '--prerelease' || '' }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} |