33 workflow_dispatch :
44 inputs :
55 submit_stores :
6- description : " Run Chrome, Firefox, and Edge store submission preflight "
6+ description : ' Run store submission artifact preflight without store credentials '
77 required : false
8- default : " false"
8+ default : ' false'
99 type : choice
1010 options :
11- - " false"
12- - " true"
13- dry_run :
14- description : " Validate store submission without uploading artifacts"
15- required : false
16- default : " true"
17- type : choice
18- options :
19- - " true"
20- - " false"
11+ - ' false'
12+ - ' true'
2113 push :
2214 tags :
23- - " v*"
24-
25- permissions :
26- id-token : " write"
27- contents : " write"
28- env :
29- GH_TOKEN : ${{ github.token }}
15+ - ' v*'
3016
3117jobs :
32- build_and_release :
18+ manual_preflight :
19+ if : github.event_name == 'workflow_dispatch'
3320 runs-on : macos-14
21+ permissions :
22+ contents : read
3423
3524 steps :
3625 - uses : actions/checkout@v7
3726 with :
38- ref : ${{ github.event_name == 'push' && 'master' || github.ref_name }}
27+ ref : ${{ github.ref }}
28+ persist-credentials : false
3929
4030 - uses : actions/setup-node@v6
4131 with :
4232 node-version : 22
4333 - run : npm ci
4434
35+ - run : npm run build
36+
37+ - run : npm run release:firefox-sources
38+
39+ - name : Submit stores preflight
40+ if : inputs.submit_stores == 'true'
41+ run : npm run release:submit:preflight
42+
43+ release :
44+ if : github.event_name == 'push'
45+ runs-on : macos-14
46+ permissions :
47+ contents : write
48+
49+ steps :
50+ - uses : actions/checkout@v7
51+ with :
52+ ref : master
53+ persist-credentials : true
54+
55+ - uses : actions/setup-node@v6
56+ with :
57+ node-version : 22
58+
4559 - name : Resolve release version
46- run : |
47- if [ "${{ github.event_name }}" = "push" ]; then
48- echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
49- else
50- version="$(node -p "require('./src/manifest.json').version")"
51- echo "VERSION=${version}" >> $GITHUB_ENV
52- fi
60+ run : printf 'VERSION=%s\n' "${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
5361
5462 - name : Update manifest.json version
55- if : github.event_name == 'push'
5663 uses : jossef/action-set-json-field@v2.2
5764 with :
5865 file : src/manifest.json
5966 field : version
6067 value : ${{ env.VERSION }}
6168
6269 - name : Update manifest.v2.json version
63- if : github.event_name == 'push'
6470 uses : jossef/action-set-json-field@v2.2
6571 with :
6672 file : src/manifest.v2.json
6773 field : version
6874 value : ${{ env.VERSION }}
6975
7076 - name : Push files
71- if : github.event_name == 'push'
72- continue-on-error : true
7377 run : |
7478 git config --global user.email "github-actions[bot]@users.noreply.github.com"
7579 git config --global user.name "github-actions[bot]"
76- git commit -am "release v${{ env.VERSION }}"
77- git push
80+ git add src/manifest.json src/manifest.v2.json
81+ if git diff --cached --quiet; then
82+ echo "No release version changes to commit"
83+ else
84+ git commit -m "release v${VERSION}"
85+ git fetch origin master
86+ git rebase FETCH_HEAD
87+ git push origin HEAD:master
88+ fi
7889
79- - if : github.event_name == 'push'
80- run : |
81- gh release create ${{github.ref_name}} -d -F CURRENT_CHANGE.md -t ${{github.ref_name}}
90+ - name : Checkout release tag for artifacts
91+ uses : actions/checkout@v7
92+ with :
93+ ref : ${{ github.ref }}
94+ persist-credentials : false
95+
96+ - run : npm ci
97+
98+ - name : Update release artifact manifest.json version
99+ uses : jossef/action-set-json-field@v2.2
100+ with :
101+ file : src/manifest.json
102+ field : version
103+ value : ${{ env.VERSION }}
104+
105+ - name : Update release artifact manifest.v2.json version
106+ uses : jossef/action-set-json-field@v2.2
107+ with :
108+ file : src/manifest.v2.json
109+ field : version
110+ value : ${{ env.VERSION }}
111+
112+ - run : |
113+ gh release create "$RELEASE_TAG" -d -F CURRENT_CHANGE.md -t "$RELEASE_TAG"
114+ env:
115+ GH_TOKEN: ${{ github.token }}
116+ RELEASE_TAG: ${{ github.ref_name }}
82117
83118 - uses : actions/setup-python@v6
84- if : github.event_name == 'push'
85119 with :
86120 python-version : ' 3.10' # for appdmg
87121 - uses : maxim-lobanov/setup-xcode@v1
88- if : github.event_name == 'push'
89122 with :
90123 xcode-version : 16.2
91- - if : github.event_name == 'push'
92- run : sed -i '' "s/0.0.0/${{ env.VERSION }}/g" safari/project.pre.patch
93- - if : github.event_name == 'push'
94- run : sed -i '' "s/0.0.0/${{ env.VERSION }}/g" safari/project.patch
95- - if : github.event_name == 'push'
96- run : npm run build:safari
97-
98- - if : github.event_name != 'push'
99- run : npm run build
124+ - run : sed -i '' "s/0.0.0/${VERSION}/g" safari/project.pre.patch
125+ - run : sed -i '' "s/0.0.0/${VERSION}/g" safari/project.patch
126+ - run : npm run build:safari
100127
101128 - run : npm run release:firefox-sources
102129
103- - if : github.event_name == 'push'
104- run : |
105- gh release upload ${{github.ref_name}} build/chromium.zip
106- gh release upload ${{github.ref_name}} build/firefox.zip
107- gh release upload ${{github.ref_name}} build/safari.dmg
108- gh release upload ${{github.ref_name}} build/chromium-without-katex-and-tiktoken.zip
109- gh release upload ${{github.ref_name}} build/firefox-without-katex-and-tiktoken.zip
130+ - run : |
131+ gh release upload "$RELEASE_TAG" build/chromium.zip
132+ gh release upload "$RELEASE_TAG" build/firefox.zip
133+ gh release upload "$RELEASE_TAG" build/safari.dmg
134+ gh release upload "$RELEASE_TAG" build/chromium-without-katex-and-tiktoken.zip
135+ gh release upload "$RELEASE_TAG" build/firefox-without-katex-and-tiktoken.zip
136+ env:
137+ GH_TOKEN: ${{ github.token }}
138+ RELEASE_TAG: ${{ github.ref_name }}
110139
111140 - name : Submit stores
112- if : github.event_name == 'push' || inputs.submit_stores == 'true'
113- run : |
114- args=()
115- if [ "${{ github.event_name }}" != "push" ]; then
116- if [ "${{ inputs.dry_run }}" != "true" ]; then
117- echo "::error::Manual store submission only supports dry_run=true. Push a v* tag for a real submission."
118- exit 1
119- fi
120- args+=(--dry-run)
121- fi
122- npm run release:submit -- "${args[@]}"
141+ run : npm run release:submit
123142 env :
124143 CHROME_EXTENSION_ID : ${{ secrets.CHROME_EXTENSION_ID }}
125144 CHROME_CLIENT_ID : ${{ secrets.CHROME_CLIENT_ID }}
@@ -137,6 +156,8 @@ jobs:
137156 EDGE_CLIENT_ID : ${{ secrets.EDGE_CLIENT_ID }}
138157 EDGE_API_KEY : ${{ secrets.EDGE_API_KEY }}
139158
140- - if : github.event_name == 'push'
141- run : |
142- gh release edit ${{github.ref_name}} --draft=false
159+ - run : |
160+ gh release edit "$RELEASE_TAG" --draft=false
161+ env:
162+ GH_TOKEN: ${{ github.token }}
163+ RELEASE_TAG: ${{ github.ref_name }}
0 commit comments