12
12
13
13
steps :
14
14
# Initialization
15
- - uses : actions/checkout@v4
15
+ - name : Checkout release branch w/submodules
16
+ uses : actions/checkout@v5
16
17
with :
17
18
submodules : recursive
18
19
- uses : actions/setup-node@v4
@@ -34,12 +35,27 @@ jobs:
34
35
path : ../builds/SourceCodeUseThisOne.zip
35
36
repo-token : ${{ secrets.GITHUB_TOKEN }}
36
37
38
+ - name : Checkout source maps branch
39
+ uses : actions/checkout@v5
40
+ with :
41
+ path : source-maps
42
+ ref : source-maps
43
+ - name : Set up committer info
44
+ run : |
45
+ git config --global user.name "github-actions[bot]"
46
+ git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
37
47
- run : npm ci
38
48
39
49
# Create Firefox artifacts
40
50
- name : Create Firefox artifacts
41
- run : npm run build:firefox
51
+ run : npm run build:firefox -- --env ghpSourceMaps
42
52
- run : mkdir ./builds
53
+ - name : Move Firefox source maps to source map repo
54
+ run : |
55
+ VERSION=`jq -r '.version' ./dist/manifest.json`
56
+ mkdir -p "./source-maps/firefox/$VERSION/"
57
+ mv -v ./dist/**/*.js.map "./source-maps/firefox/$VERSION/"
58
+ cp -v ./dist/**/*.js.LICENSE.txt "./source-maps/firefox/$VERSION/"
43
59
- name : Zip Artifacts
44
60
run : cd ./dist ; zip -r ../builds/FirefoxExtension.zip *
45
61
- name : Upload FirefoxExtension to release
52
68
53
69
# Create Chrome artifacts
54
70
- name : Create Chrome artifacts
55
- run : npm run build:chrome
71
+ run : npm run build:chrome -- --env ghpSourceMaps
72
+ - name : Move Chrome source maps to source map repo
73
+ run : |
74
+ VERSION=`jq -r '.version' ./dist/manifest.json`
75
+ mkdir -p "./source-maps/chrome/$VERSION/"
76
+ mv -v ./dist/**/*.js.map "./source-maps/chrome/$VERSION/"
77
+ cp -v ./dist/**/*.js.LICENSE.txt "./source-maps/chrome/$VERSION/"
56
78
- name : Zip Artifacts
57
79
run : cd ./dist ; zip -r ../builds/ChromeExtension.zip *
58
80
- name : Upload ChromeExtension to release
67
89
- name : Clear dist for Edge
68
90
run : rm -rf ./dist
69
91
- name : Create Edge artifacts
70
- run : npm run build:edge
92
+ run : npm run build:edge -- --env ghpSourceMaps
93
+ - name : Move Edge source maps to source map repo
94
+ run : |
95
+ VERSION=`jq -r '.version' ./dist/manifest.json`
96
+ mkdir -p "./source-maps/edge/$VERSION/"
97
+ mv -v ./dist/**/*.js.map "./source-maps/edge/$VERSION/"
98
+ cp -v ./dist/**/*.js.LICENSE.txt "./source-maps/edge/$VERSION/"
71
99
- name : Zip Artifacts
72
100
run : cd ./dist ; zip -r ../builds/EdgeExtension.zip *
73
101
- name : Upload EdgeExtension to release
@@ -80,7 +108,13 @@ jobs:
80
108
81
109
# Create Safari artifacts
82
110
- name : Create Safari artifacts
83
- run : npm run build:safari
111
+ run : npm run build:safari -- --env ghpSourceMaps
112
+ - name : Move Safari source maps to source map repo
113
+ run : |
114
+ VERSION=`jq -r '.version' ./dist/manifest.json`
115
+ mkdir -p "./source-maps/safari/$VERSION/"
116
+ mv -v ./dist/**/*.js.map "./source-maps/safari/$VERSION/"
117
+ cp -v ./dist/**/*.js.LICENSE.txt "./source-maps/safari/$VERSION/"
84
118
- name : Zip Artifacts
85
119
run : cd ./dist ; zip -r ../builds/SafariExtension.zip *
86
120
- name : Upload SafariExtension to release
@@ -93,7 +127,13 @@ jobs:
93
127
94
128
# Create Beta artifacts (Builds with the name changed to beta)
95
129
- name : Create Chrome Beta artifacts
96
- run : npm run build:chrome -- --env stream=beta
130
+ run : npm run build:chrome -- --env stream=beta --env ghpSourceMaps
131
+ - name : Move Chrome Beta source maps to source map repo
132
+ run : |
133
+ VERSION=`jq -r '.version' ./dist/manifest.json`
134
+ mkdir -p "./source-maps/chrome-beta/$VERSION/"
135
+ mv -v ./dist/**/*.js.map "./source-maps/chrome-beta/$VERSION/"
136
+ cp -v ./dist/**/*.js.LICENSE.txt "./source-maps/chrome-beta/$VERSION/"
97
137
- name : Zip Artifacts
98
138
run : cd ./dist ; zip -r ../builds/ChromeExtensionBeta.zip *
99
139
- name : Upload ChromeExtensionBeta to release
@@ -106,11 +146,17 @@ jobs:
106
146
107
147
# Firefox Beta
108
148
- name : Create Firefox Beta artifacts
109
- run : npm run build:firefox -- --env stream=beta
149
+ run : npm run build:firefox -- --env stream=beta --env autoupdate --env ghpSourceMaps
110
150
- uses : actions/upload-artifact@v4
111
151
with :
112
152
name : FirefoxExtensionBeta
113
153
path : dist
154
+ - name : Move Firefox Beta source maps to source map repo
155
+ run : |
156
+ VERSION=`jq -r '.version' ./dist/manifest.json`
157
+ mkdir -p "./source-maps/firefox-beta/$VERSION/"
158
+ mv -v ./dist/**/*.js.map "./source-maps/firefox-beta/$VERSION/"
159
+ cp -v ./dist/**/*.js.LICENSE.txt "./source-maps/firefox-beta/$VERSION/"
114
160
- name : Zip Artifacts
115
161
run : cd ./dist ; zip -r ../builds/FirefoxExtensionBeta.zip *
116
162
@@ -120,10 +166,8 @@ jobs:
120
166
env :
121
167
WEB_EXT_API_KEY : ${{ secrets.WEB_EXT_API_KEY }}
122
168
WEB_EXT_API_SECRET : ${{ secrets.WEB_EXT_API_SECRET }}
123
- - name : Install rename
124
- run : sudo apt-get install rename
125
169
- name : Rename signed file
126
- run : cd ./web-ext-artifacts ; rename 's/.*/ FirefoxSignedInstaller.xpi/' *
170
+ run : mv ./web-ext-artifacts/* ./web-ext-artifacts/ FirefoxSignedInstaller.xpi
127
171
- uses : actions/upload-artifact@v4
128
172
with :
129
173
name : FirefoxExtensionSigned.xpi
@@ -137,3 +181,80 @@ jobs:
137
181
path : ./web-ext-artifacts/FirefoxSignedInstaller.xpi
138
182
repo-token : ${{ secrets.GITHUB_TOKEN }}
139
183
184
+ - name : Commit & push new source maps
185
+ if : always()
186
+ run : |
187
+ VERSION=`jq -r '.version' ./dist/manifest.json`
188
+ cd ./source-maps
189
+ git add .
190
+ git commit -m "Publish source maps for version $VERSION"
191
+ git push
192
+
193
+ - name : Prepare new github pages deployment
194
+ shell : python
195
+ run : |
196
+ from pathlib import Path
197
+ import json
198
+ import shutil
199
+ import os
200
+
201
+ # config stuff
202
+ installer_name = "FirefoxSignedInstaller.xpi"
203
+ owner, repo_name = os.environ["GITHUB_REPOSITORY"].split("/")
204
+ owner = owner.lower()
205
+
206
+ # create the github paged dir
207
+ ghp_dir = Path("./github-pages")
208
+ ghp_dir.mkdir(parents=True, exist_ok=True)
209
+
210
+ # move in the installer
211
+ Path("./web-ext-artifacts", installer_name).rename(ghp_dir / installer_name)
212
+
213
+ # read manifest.json and extract parameters
214
+ with open("./dist/manifest.json") as f:
215
+ manifest = json.load(f)
216
+ current_version = manifest["version"]
217
+ ext_id = manifest["browser_specific_settings"]["gecko"]["id"]
218
+
219
+ # generate updates file
220
+ updates = {
221
+ "addons": {
222
+ ext_id: {
223
+ "updates": [
224
+ {
225
+ "version": current_version,
226
+ # param doesn't actually matter, it's just a cachebuster
227
+ "update_link": f"https://{owner}.github.io/{repo_name}/{installer_name}?v={current_version}",
228
+ },
229
+ ],
230
+ },
231
+ },
232
+ }
233
+ (ghp_dir / "updates.json").write_text(json.dumps(updates))
234
+
235
+ # copy in source maps
236
+ def only_sourcemaps(cur, ls):
237
+ if '/' in cur:
238
+ return []
239
+ return set(ls) - {"chrome", "chrome-beta", "edge", "firefox", "firefox-beta", "safari"}
240
+ shutil.copytree("source-maps", ghp_dir, ignore=only_sourcemaps, dirs_exist_ok=True)
241
+
242
+ - name : Upload new github pages deployment
243
+ uses : actions/upload-pages-artifact@v3
244
+ with :
245
+ path : ./github-pages
246
+
247
+ deploy-ghp :
248
+ name : Deploy to github pages
249
+ needs : build
250
+ permissions :
251
+ id-token : write
252
+ pages : write
253
+ environment :
254
+ name : github-pages
255
+ url : ${{ steps.deployment.outputs.page_url }}
256
+ runs-on : ubuntu-latest
257
+ steps :
258
+ - name : Deploy
259
+ id : deployment
260
+ uses : actions/deploy-pages@v4
0 commit comments