Skip to content

Commit 677ef45

Browse files
committed
ci: draft-first release flow for immutable-releases compatibility
The repo has GitHub's immutable-releases lockdown enabled. The previous flow had softprops/action-gh-release publish the release in one shot, which raced the asset upload against the lockdown — uploads to a just-published immutable release fail with "Cannot upload asset … to an immutable release". The v0.2.0-pre.1 release ended up published with no docker-compose-debugger.html asset attached. Update all three release workflows (prerelease, release, stable-release) to: 1. Create the release with draft: true so the lockdown isn't applied. 2. Upload the single-file HTML asset (allowed on drafts). 3. Publish via `gh release edit "$TAG" --draft=false` in a follow-up step. The lockdown then applies to the already-attached asset. This is the workaround the action's own error message recommends.
1 parent b3adf5c commit 677ef45

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

.github/workflows/prerelease.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,20 @@ jobs:
6565
git tag "$TAG"
6666
git push origin "$TAG"
6767
68+
# The repo has immutable releases enabled. softprops/action-gh-release
69+
# creates and publishes in one step, which means the asset upload races
70+
# against the immutable lockdown and fails. Create as draft, upload the
71+
# asset, then publish in a follow-up step.
6872
- uses: softprops/action-gh-release@v2
6973
with:
7074
tag_name: ${{ steps.prerelease.outputs.tag }}
7175
files: docker-compose-debugger.html
7276
generate_release_notes: true
7377
prerelease: true
78+
draft: true
79+
80+
- name: Publish pre-release
81+
env:
82+
TAG: ${{ steps.prerelease.outputs.tag }}
83+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
run: gh release edit "$TAG" --repo "${{ github.repository }}" --draft=false

.github/workflows/release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,17 @@ jobs:
2020
- run: npm ci
2121
- run: npm run build
2222
- run: cp dist/index.html docker-compose-debugger.html
23+
# Immutable releases require draft-first so assets can be attached
24+
# before the release is locked.
2325
- uses: softprops/action-gh-release@v2
2426
with:
2527
files: docker-compose-debugger.html
2628
generate_release_notes: true
2729
prerelease: ${{ contains(github.ref, '-') }}
30+
draft: true
31+
32+
- name: Publish release
33+
env:
34+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
TAG: ${{ github.ref_name }}
36+
run: gh release edit "$TAG" --repo "${{ github.repository }}" --draft=false

.github/workflows/stable-release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,18 @@ jobs:
6262
git tag "v${VERSION}"
6363
git push origin main --follow-tags
6464
65+
# Immutable releases require draft-first so assets can be attached
66+
# before the release is locked.
6567
- uses: softprops/action-gh-release@v2
6668
with:
6769
tag_name: v${{ inputs.version }}
6870
files: docker-compose-debugger.html
6971
generate_release_notes: true
7072
prerelease: false
73+
draft: true
74+
75+
- name: Publish release
76+
env:
77+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
TAG: v${{ inputs.version }}
79+
run: gh release edit "$TAG" --repo "${{ github.repository }}" --draft=false

0 commit comments

Comments
 (0)