Skip to content

Commit 4ea5692

Browse files
committed
Unify CI jobs
1 parent e272de6 commit 4ea5692

16 files changed

+995
-3187
lines changed
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
name: "Browser Extensions"
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
pull_request:
8+
paths:
9+
- browser-extension/**
10+
- .github/workflows/**
11+
push:
12+
paths:
13+
- browser-extension/**
14+
- .github/workflows/**
15+
branches:
16+
- '**'
17+
tags-ignore:
18+
# Don't run again on tags since we already run on all branches.
19+
- '**'
20+
jobs:
21+
build-extensions:
22+
name: Build and bundle the browser extensions
23+
runs-on: ubuntu-latest
24+
defaults:
25+
run:
26+
shell: bash
27+
working-directory: browser-extension
28+
outputs:
29+
version: ${{ steps.get-version.outputs.version }}
30+
steps:
31+
- name: Check out repository code
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0 # Fetch all history for tags
35+
36+
- name: Set up Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: '22'
40+
41+
- name: Install dependencies
42+
run: npm install
43+
44+
- name: Get version from git tag
45+
id: get-version
46+
run: |
47+
VERSION=$(node get-version.js)
48+
if [[ -z "$VERSION" ]]; then
49+
echo "❌ Version extraction failed"
50+
exit 1
51+
fi
52+
echo "version=$VERSION" >> $GITHUB_OUTPUT
53+
echo "Using version: $VERSION"
54+
55+
- name: Build extensions
56+
run: |
57+
npm run build
58+
59+
- name: Run Firefox linting
60+
run: |
61+
npm run lint-firefox
62+
63+
- name: Package Chrome extension
64+
# Note that the CI artifact will be double-zipped because actions/upload-artifact zips it again.
65+
# But this is necessary because actions/download-artifact will always attempt to unzip.
66+
run: |
67+
npm run package-chrome
68+
69+
- name: Package Firefox extension (unsigned)
70+
run: |
71+
npm run package-firefox
72+
73+
- name: Package Firefox extension (signed for release)
74+
# Only sign versions that we actually intend to release. Mozilla does not allow the same version
75+
# number to be signed multiple times, so duplicated build attempts will fail.
76+
if: ${{ github.event_name == 'release' }}
77+
env:
78+
WEB_EXT_API_KEY: ${{ secrets.FIREFOX_JWT_ISSUER }}
79+
WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_JWT_SECRET }}
80+
run: |
81+
npm run sign-firefox
82+
83+
- name: Validate manifest files
84+
run: |
85+
if [[ ! -f "build/chrome/manifest.json" ]] || [[ ! -f "build/firefox/manifest.json" ]]; then
86+
echo "❌ Manifest files not found"
87+
exit 1
88+
fi
89+
90+
# Check that version was injected correctly
91+
CHROME_VERSION=$(jq .version build/chrome/manifest.json)
92+
FIREFOX_VERSION=$(jq .version build/firefox/manifest.json)
93+
94+
if [[ -z "$CHROME_VERSION" ]] || [[ "null" == "$CHROME_VERSION" ]]; then
95+
echo "❌ Manifest missing version number"
96+
exit 1
97+
fi
98+
99+
if [[ "$CHROME_VERSION" != "$FIREFOX_VERSION" ]]; then
100+
echo "❌ Version mismatch between Chrome ($CHROME_VERSION) and Firefox ($FIREFOX_VERSION)"
101+
exit 1
102+
fi
103+
104+
echo "✅ Manifest validation passed - Version: $CHROME_VERSION"
105+
106+
- name: Upload Chrome extension artifact
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: chrome-extension-v${{ steps.get-version.outputs.version }}
110+
path: browser-extension/build/chrome-extension.zip
111+
112+
- name: Upload Firefox extension artifact (unsigned)
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: firefox-extension-unsigned-v${{ steps.get-version.outputs.version }}
116+
path: browser-extension/build/firefox-extension.zip
117+
118+
- name: Upload Firefox extension artifact (signed)
119+
if: ${{ github.event_name == 'release' }}
120+
uses: actions/upload-artifact@v4
121+
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

.github/workflows/browser-extension-release.yml

Lines changed: 0 additions & 169 deletions
This file was deleted.

0 commit comments

Comments
 (0)