fix: ci for releases #8
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 | |
| # Cuts a release only when package.json's version changes on master: | |
| # the build runs when no tag matches the current version, then tags + publishes. | |
| on: | |
| push: | |
| branches: [master] | |
| permissions: | |
| contents: write | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.v.outputs.version }} | |
| exists: ${{ steps.v.outputs.exists }} | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - id: v | |
| run: | | |
| version="$(node -p "require('./package.json').version")" | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| if git ls-remote --exit-code --tags origin "refs/tags/v$version" >/dev/null 2>&1; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| release: | |
| needs: check | |
| if: needs.check.outputs.exists == 'false' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| # pnpm version comes from the "packageManager" field in package.json | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm zip | |
| - uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1 | |
| with: | |
| tag_name: v${{ needs.check.outputs.version }} | |
| files: .output/*.zip | |
| generate_release_notes: true | |
| - name: Submit to Chrome Web Store | |
| run: pnpm wxt submit --chrome-zip .output/*.zip --chrome-skip-submit-review | |
| env: | |
| CHROME_EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }} | |
| CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }} | |
| CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }} | |
| CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }} |