feat: add results page #15
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: Build Extension Packages | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - "README.md" | |
| - "LICENSE" | |
| pull_request: | |
| branches: [main] | |
| paths-ignore: | |
| - "README.md" | |
| - "LICENSE" | |
| workflow_dispatch: # Allows manual re-run from GitHub UI | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build extension packages | |
| run: npm run build | |
| - name: Upload Chrome extension artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: carbon-visualizer-chrome | |
| path: build/carbon-visualizer-chrome.zip | |
| retention-days: 30 | |
| - name: Upload Firefox extension artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: carbon-visualizer-firefox | |
| path: build/carbon-visualizer-firefox.zip | |
| retention-days: 30 | |
| - name: Comment PR with artifact links | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const botComment = comments.find(comment => | |
| comment.user.type === 'Bot' && | |
| comment.body.includes('📦 Extension packages built successfully!') | |
| ); | |
| const commentBody = `📦 Extension packages built successfully! | |
| **[Download your Chrome and Firefox extension packages](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})**`; | |
| if (botComment) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: botComment.id, | |
| body: commentBody | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: commentBody | |
| }); | |
| } | |
| - name: Notify on failure | |
| if: failure() | |
| run: | | |
| echo "❌ Build failed! Check the logs above for details." |