|
1 | | -name: "Browser Extensions" |
| 1 | +name: "Build Browser Extensions" # If you change this name, you'll also need to update the release.yaml job |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: |
5 | | - release: |
6 | | - types: [published] |
7 | 5 | pull_request: |
8 | 6 | paths: |
9 | 7 | - browser-extension/** |
|
14 | 12 | - .github/workflows/** |
15 | 13 | branches: |
16 | 14 | - '**' |
17 | | - tags-ignore: |
18 | | - # Don't run again on tags since we already run on all branches. |
19 | | - - '**' |
| 15 | + tags: |
| 16 | + # Only run on release tags: |
| 17 | + - 'v[0-9]+.[0-9]+.[0-9]+' |
| 18 | + |
20 | 19 | jobs: |
21 | 20 | build-extensions: |
22 | 21 | name: Build and bundle the browser extensions |
| 22 | + # Since we run on both branch pushes and PRs, don't do a duplicated run if the PR is for a branch in the local repo: |
| 23 | + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name |
23 | 24 | runs-on: ubuntu-latest |
24 | 25 | defaults: |
25 | 26 | run: |
26 | 27 | shell: bash |
27 | 28 | working-directory: browser-extension |
28 | | - outputs: |
29 | | - version: ${{ steps.get-version.outputs.version }} |
30 | 29 | steps: |
31 | 30 | - name: Check out repository code |
32 | 31 | uses: actions/checkout@v4 |
33 | 32 | with: |
34 | | - fetch-depth: 0 # Fetch all history for tags |
| 33 | + fetch-depth: 0 # Fetch all history to pull git tags |
35 | 34 |
|
36 | 35 | - name: Set up Node.js |
37 | 36 | uses: actions/setup-node@v4 |
|
52 | 51 | echo "version=$VERSION" >> $GITHUB_OUTPUT |
53 | 52 | echo "Using version: $VERSION" |
54 | 53 |
|
55 | | - - name: Build extensions |
| 54 | + - name: Build our browser extensions |
56 | 55 | run: | |
57 | 56 | npm run build |
58 | 57 |
|
|
71 | 70 | npm run package-firefox |
72 | 71 |
|
73 | 72 | - name: Package Firefox extension (signed for release) |
| 73 | + id: sign-firefox-extension |
74 | 74 | # Only sign versions that we actually intend to release. Mozilla does not allow the same version |
75 | 75 | # number to be signed multiple times, so duplicated build attempts will fail. |
76 | | - if: ${{ github.event_name == 'release' }} |
| 76 | + if: ${{ github.ref_type == 'tag' }} |
77 | 77 | env: |
78 | 78 | WEB_EXT_API_KEY: ${{ secrets.FIREFOX_JWT_ISSUER }} |
79 | 79 | WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_JWT_SECRET }} |
@@ -103,56 +103,37 @@ jobs: |
103 | 103 |
|
104 | 104 | echo "✅ Manifest validation passed - Version: $CHROME_VERSION" |
105 | 105 |
|
| 106 | + - name: Rename Chrome extension |
| 107 | + run: | |
| 108 | + mv ./build/chrome-extension.zip ./build/chrome-extension-v${{ steps.get-version.outputs.version }}.zip |
| 109 | +
|
| 110 | + - name: Rename Firefox extension (unsigned) |
| 111 | + run: | |
| 112 | + mv ./build/firefox-extension.zip ./build/firefox-extension-unsigned-v${{ steps.get-version.outputs.version }}.zip |
| 113 | +
|
| 114 | + - name: Rename Firefox extension (signed) |
| 115 | + if: ${{ steps.sign-firefox-extension.outcome != 'skipped' }} |
| 116 | + run: | |
| 117 | + mv ./build/streamdeck_googlemeet-${{ steps.get-version.outputs.version }}.xpi ./build/firefox-extension-v${{ steps.get-version.outputs.version }}.xpi |
| 118 | +
|
106 | 119 | - name: Upload Chrome extension artifact |
107 | 120 | uses: actions/upload-artifact@v4 |
108 | 121 | with: |
109 | | - name: chrome-extension-v${{ steps.get-version.outputs.version }} |
110 | | - path: browser-extension/build/chrome-extension.zip |
| 122 | + # If you change this artifact name or filename, you must also update the release job's download-artifact steps. |
| 123 | + name: chrome-extension |
| 124 | + path: browser-extension/build/chrome-extension-v${{ steps.get-version.outputs.version }}.zip |
111 | 125 |
|
112 | 126 | - name: Upload Firefox extension artifact (unsigned) |
113 | 127 | uses: actions/upload-artifact@v4 |
114 | 128 | with: |
115 | | - name: firefox-extension-unsigned-v${{ steps.get-version.outputs.version }} |
116 | | - path: browser-extension/build/firefox-extension.zip |
| 129 | + # If you change this artifact name or filename, you must also update the release job's download-artifact steps. |
| 130 | + name: firefox-extension-unsigned |
| 131 | + path: browser-extension/build/firefox-extension-unsigned-v${{ steps.get-version.outputs.version }}.zip |
117 | 132 |
|
118 | 133 | - name: Upload Firefox extension artifact (signed) |
119 | | - if: ${{ github.event_name == 'release' }} |
| 134 | + if: ${{ steps.sign-firefox-extension.outcome != 'skipped' }} |
120 | 135 | uses: actions/upload-artifact@v4 |
121 | 136 | with: |
122 | | - name: firefox-extension-signed-v${{ steps.get-version.outputs.version }} |
123 | | - path: browser-extension/build/streamdeck_googlemeet-${{ steps.get-version.outputs.version }}.xpi |
124 | | - |
125 | | - attach-to-release: |
126 | | - name: Attach artifacts to the GitHub Release |
127 | | - if: ${{ github.event_name == 'release' }} |
128 | | - runs-on: ubuntu-latest |
129 | | - needs: [build-extensions] |
130 | | - permissions: |
131 | | - contents: write # Needed for softprops/action-gh-release |
132 | | - steps: |
133 | | - - name: Download Chrome extension |
134 | | - uses: actions/download-artifact@v4 |
135 | | - with: |
136 | | - name: chrome-extension-v${{ needs.build-extensions.outputs.version }} |
137 | | - path: ./artifacts |
138 | | - |
139 | | - - name: Rename Chrome extension |
140 | | - run: | |
141 | | - mv ./artifacts/chrome-extension.zip ./chrome-extension-v${{ needs.build-extensions.outputs.version }}.zip |
142 | | -
|
143 | | - - name: Download Firefox extension |
144 | | - uses: actions/download-artifact@v4 |
145 | | - with: |
146 | | - name: firefox-extension-signed-v${{ needs.build-extensions.outputs.version }} |
147 | | - path: ./artifacts |
148 | | - |
149 | | - - name: Rename Firefox extension |
150 | | - run: | |
151 | | - mv ./artifacts/streamdeck_googlemeet-${{ needs.build-extensions.outputs.version }}.xpi ./firefox-extension-v${{ needs.build-extensions.outputs.version }}.xpi |
152 | | -
|
153 | | - - name: Attach all artifacts to release |
154 | | - uses: softprops/action-gh-release@v2 |
155 | | - with: |
156 | | - files: | |
157 | | - ./chrome-extension-v${{ needs.build-extensions.outputs.version }}.zip |
158 | | - ./firefox-extension-v${{ needs.build-extensions.outputs.version }}.xpi |
| 137 | + # If you change this artifact name or filename, you must also update the release job's download-artifact steps. |
| 138 | + name: firefox-extension-signed |
| 139 | + path: browser-extension/build/firefox-extension-v${{ steps.get-version.outputs.version }}.xpi |
0 commit comments