test(icons): add test files #14
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 | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: [master] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| env: | |
| NODE_VERSION: "20" | |
| ARTIFACT_PREFIX: "github-icons" | |
| jobs: | |
| release: | |
| if: > | |
| github.event_name == 'workflow_dispatch' || ( | |
| github.event.pull_request.merged == true && | |
| !contains(toJson(github.event.pull_request.labels), '"no-release"') && | |
| !contains(github.event.pull_request.title, '[no-release]') | |
| ) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Extract version | |
| id: version | |
| run: echo "version=$(node -p 'require("./package.json").version')" >> $GITHUB_OUTPUT | |
| - name: Build & zip (Chrome) | |
| run: npx wxt zip | |
| - name: Build & zip (Firefox) | |
| run: npx wxt zip -b firefox | |
| - name: Build & zip Safari extension | |
| run: | | |
| npx wxt build -b safari | |
| SAFARI_DIR=$(ls -d output/safari-* 2>/dev/null | head -1) | |
| cd "$SAFARI_DIR" && zip -qr "../${{ env.ARTIFACT_PREFIX }}-${{ steps.version.outputs.version }}-safari.zip" . | |
| - name: Rename artifacts for clarity | |
| run: | | |
| cd output | |
| mv *-chrome.zip "${{ env.ARTIFACT_PREFIX }}-${{ steps.version.outputs.version }}-chrome.zip" 2>/dev/null || true | |
| mv *-firefox.zip "${{ env.ARTIFACT_PREFIX }}-${{ steps.version.outputs.version }}-firefox.zip" 2>/dev/null || true | |
| - name: Compute release metadata | |
| id: meta | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| echo "tag=v${VERSION}" >> $GITHUB_OUTPUT | |
| echo "name=Release - ${VERSION}" >> $GITHUB_OUTPUT | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.meta.outputs.tag }} | |
| name: ${{ steps.meta.outputs.name }} | |
| generate_release_notes: true | |
| files: output/*.zip | |
| - name: Publish to Chrome Web Store | |
| uses: browser-actions/release-chrome-extension@v0 | |
| continue-on-error: true | |
| with: | |
| extension-id: ${{ secrets.CWS_EXTENSION_ID }} | |
| extension-path: output/${{ env.ARTIFACT_PREFIX }}-${{ steps.version.outputs.version }}-chrome.zip | |
| oauth-client-id: ${{ secrets.CWS_CLIENT_ID }} | |
| oauth-client-secret: ${{ secrets.CWS_CLIENT_SECRET }} | |
| oauth-refresh-token: ${{ secrets.CWS_REFRESH_TOKEN }} | |
| publish-target: default |