Skip to content

Commit abeaca1

Browse files
committed
Consolidate check-release and publish-release jobs
To avoid setting `GITHUB_TOKEN` where not needed, this defines it in `env:` for each individual step that needs it, as elsewhere. This is more awkward than in the other jobs, since half the steps use it here, but this may be okay.
1 parent 20a498d commit abeaca1

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -292,23 +292,25 @@ jobs:
292292
env:
293293
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
294294

295-
check-release:
296-
name: check-release
295+
publish-release:
296+
name: publish-release
297297

298298
runs-on: ubuntu-latest
299299

300300
needs: [ create-release, build-release, build-macos-universal2-release ]
301301

302+
env:
303+
REPOSITORY: ${{ github.repository }}
304+
VERSION: ${{ needs.create-release.outputs.version }}
305+
302306
steps:
303307
- name: Discover assets
304308
run: |
305309
gh release --repo="$REPOSITORY" view "$VERSION" --json assets --jq '.assets.[].name' > assets.txt
306310
env:
307-
REPOSITORY: ${{ github.repository }}
308-
VERSION: ${{ needs.create-release.outputs.version }}
309311
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
310312

311-
- name: Show all asset names
313+
- name: Show all individual asset names
312314
run: cat assets.txt
313315

314316
# The `features` array is repeated because GHA doen't support YAML anchors.
@@ -326,34 +328,33 @@ jobs:
326328
diff -- <(mask aarch64) <(mask universal)
327329
diff -- <(mask x86_64) <(mask universal)
328330
329-
publish-release:
330-
name: publish-release
331-
332-
runs-on: ubuntu-latest
333-
334-
needs: [ create-release, check-release ]
335-
336-
env:
337-
REPOSITORY: ${{ github.repository }}
338-
VERSION: ${{ needs.create-release.outputs.version }}
339-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
331+
- name: Clean up local temporary macOS asset list files
332+
run: rm {assets,aarch64,x86_64,universal}.txt
340333

341-
steps:
342-
- name: Retrieve individual checksums
334+
- name: Retrieve all individual checksums
343335
run: gh release --repo="$REPOSITORY" download "$VERSION" --pattern='gitoxide-*.sha256'
336+
env:
337+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
344338

345339
- name: Concatenate checksums into one file
346340
run: cat gitoxide-*.sha256 > hashes.sha256
347341

348342
- name: Upload the combined checksum file
349343
run: gh release --repo="$REPOSITORY" upload "$VERSION" hashes.sha256
344+
env:
345+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
350346

351-
- name: Discard the individual checksum files
347+
# If any step of any job fails before this, the draft still has the individual checksum files.
348+
- name: Remove the individual checksum file assets
352349
run: |
353350
for sumfile in gitoxide-*.sha256; do
354351
gh release --repo="$REPOSITORY" delete-asset "$VERSION" "$sumfile" --yes
355352
done
353+
env:
354+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
356355

357356
- name: Publish the release
358357
if: false
359358
run: gh release --repo="$REPOSITORY" edit "$VERSION" --draft=false
359+
env:
360+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)