Release Extension #6
Workflow file for this run
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 Extension | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| name: Build & Release Extension | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'pnpm' | |
| - name: Install Dependencies | |
| run: pnpm install | |
| - name: Extract Version from Tag | |
| id: get_version | |
| run: | | |
| TAG="${{ github.ref_name }}" | |
| VERSION="${TAG#v}" | |
| echo "TAG=$TAG" >> $GITHUB_ENV | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "Tag: $TAG Version: $VERSION" | |
| - name: Build and Package Chrome MV3 Extension | |
| run: pnpm zip | |
| - name: Build and Package Firefox MV2 Extension | |
| run: pnpm zip:firefox | |
| - name: Verify Built Artifacts | |
| run: | | |
| echo "Checking built artifacts in .output/ directory:" | |
| ls -la .output/ | |
| - name: Extract Changelog for Current Version | |
| id: changelog | |
| run: | | |
| # Extract content between the first and second '## [' headers | |
| NOTES=$(awk '/^## \[/{if(found) exit; found=1; next} found' CHANGELOG.md | sed '/^---$/d' | sed '/^[[:space:]]*$/d;$d' || true) | |
| echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV | |
| echo "$NOTES" >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| - name: Create GitHub Release and Upload Artifacts | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.TAG }} | |
| name: Release ${{ env.TAG }} | |
| body: ${{ env.RELEASE_NOTES }} | |
| files: | | |
| .output/*.zip | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |