Skip to content

Commit 6299734

Browse files
authored
Fix publish workflow (#142)
Fixes the publish workflow for reproducible firefox builds.
1 parent ea59f5f commit 6299734

File tree

2 files changed

+64
-39
lines changed

2 files changed

+64
-39
lines changed

.github/workflows/publish.yml

Lines changed: 52 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,60 +7,80 @@ on:
77
release:
88
types: [published]
99

10+
env:
11+
VERSION: ${{ github.event.release.tag_name }}
12+
1013
jobs:
11-
publish:
12-
runs-on: ubuntu-latest
14+
publish-firefox:
15+
runs-on: ubuntu-24.04
1316
steps:
1417
- uses: actions/checkout@v4
18+
1519
- uses: actions/setup-node@v4
1620
with:
1721
node-version: "22"
22+
1823
- name: Generate source archive
1924
run: npm run archive
20-
env:
21-
VERSION: ${{ github.event.release.tag_name }}
25+
26+
- name: Upload source archive
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: codecov-browser-extension-${{ github.event.release.tag_name }}.tar.gz
30+
path: codecov-browser-extension-${{ github.event.release.tag_name }}.tar.gz
31+
2232
- name: Install dependencies
2333
run: npm ci
24-
- name: Build extension
25-
run: npm run build
34+
35+
- name: Build Firefox extension
36+
run: npm run build:firefox
2637
env:
2738
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
28-
VERSION: ${{ github.event.release.tag_name }}
29-
- name: Prepare Firefox extension
30-
run: |
31-
cp -r dist dist-chrome
32-
mv dist/manifest.firefox.json dist/manifest.json
33-
npm run set-version
34-
mv dist dist-firefox
35-
- name: Upload built Chrome extension
36-
uses: actions/upload-artifact@v4
37-
with:
38-
name: codecov-chrome-${{ github.event.release.tag_name }}
39-
path: ./dist-chrome/
39+
4040
- name: Upload built Firefox extension
4141
uses: actions/upload-artifact@v4
4242
with:
4343
name: codecov-firefox-${{ github.event.release.tag_name }}
44-
path: ./dist-firefox/
45-
- name: Upload source archive
44+
path: ./dist/
45+
46+
- name: Publish to Firefox
47+
working-directory: dist
48+
run: npx web-ext sign
49+
env:
50+
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_JWT_ISSUER }}
51+
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_JWT_SECRET }}
52+
WEB_EXT_CHANNEL: listed
53+
WEB_EXT_UPLOAD_SOURCE_CODE: ../codecov-browser-extension-${{ github.event.release.tag_name }}.tar.gz
54+
WEB_EXT_APPROVAL_TIMEOUT: 0 # Disable timeout for approval
55+
56+
publish-chrome:
57+
runs-on: ubuntu-24.04
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- uses: actions/setup-node@v4
62+
with:
63+
node-version: "22"
64+
65+
- name: Install dependencies
66+
run: npm ci
67+
68+
- name: Build Chrome extension
69+
run: npm run build
70+
env:
71+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
72+
73+
- name: Upload built Chrome extension
4674
uses: actions/upload-artifact@v4
4775
with:
48-
name: codecov-browser-extension-${{ github.event.release.tag_name }}.tar.gz
49-
path: codecov-browser-extension-${{ github.event.release.tag_name }}.tar.gz
76+
name: codecov-chrome-${{ github.event.release.tag_name }}
77+
path: ./dist/
78+
5079
- name: Publish to Chrome
51-
working-directory: dist-chrome
80+
working-directory: dist
5281
run: npx chrome-webstore-upload-cli@3
5382
env:
5483
EXTENSION_ID: "gedikamndpbemklijjkncpnolildpbgo"
5584
CLIENT_ID: ${{ secrets.GOOGLE_WEB_STORE_CLIENT_ID }}
5685
CLIENT_SECRET: ${{ secrets.GOOGLE_WEB_STORE_CLIENT_SECRET }}
5786
REFRESH_TOKEN: ${{ secrets.GOOGLE_WEB_STORE_REFRESH_TOKEN }}
58-
- name: Publish to Firefox
59-
working-directory: dist-firefox
60-
run: npx web-ext sign
61-
env:
62-
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_JWT_ISSUER }}
63-
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_JWT_SECRET }}
64-
WEB_EXT_CHANNEL: listed
65-
WEB_EXT_UPLOAD_SOURCE_CODE: ../codecov-browser-extension-${{ github.event.release.tag_name }}.tar.gz
66-
WEB_EXT_APPROVAL_TIMEOUT: 0 # Disable timeout for approval

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,12 @@ These steps will build the extension in the `dist/` folder.
8888

8989
Node 22, `npm` 10, `git`, and `jq` are required to build the extension.
9090

91+
If you're a reviewer from Mozilla, hi! Please note that we have previously seen differences in build output between AMD64 and ARM64. In our CD pipeline we build on Ubuntu 24.04 AMD64, so please stick to that architecture if possible to eliminate any environment differences.
92+
9193
### Set Local Version
9294

95+
If you're a reviewer from Mozilla, you don't need to do this.
96+
9397
To override the local version of the extension, you can set the `VERSION` environment variable before building. This is useful for testing or development purposes.
9498

9599
E.g.
@@ -99,20 +103,21 @@ $ export VERSION=1.0.0
99103

100104
### Use Development Sentry DSN
101105

106+
If you're a reviewer from Mozilla, you don't need to do this.
107+
102108
If you want to use Sentry while developing, you can override the DSN value by first copying the example config (`cp .env.example .env.local`) and then filling in the environment variable.
103109

104-
### Chrome
110+
### Firefox
105111

106112
```sh
107-
$ npm install
108-
$ npm run build
113+
$ npm ci
114+
$ npm run build:firefox
109115
```
110-
111-
### Firefox
116+
### Chrome
112117

113118
```sh
114-
$ npm install
115-
$ npm run build:firefox
119+
$ npm ci
120+
$ npm run build
116121
```
117122

118123
## About Codecov

0 commit comments

Comments
 (0)