Skip to content

Commit df86ef9

Browse files
authored
Merge pull request #434 from irfanuddinahmad/irfanuddinahmad/fix-release-immutable-assets
fix: create GitHub release with assets attached, not after publish
2 parents dbe94e1 + 22ae6b0 commit df86ef9

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,29 @@ jobs:
3737
git_committer_name: "github-actions"
3838
git_committer_email: "[email protected]"
3939
changelog: "false"
40+
# Commit, tag, push and build, but don't create the GitHub release.
41+
# We create it ourselves in the next step so that the distributions
42+
# are attached before the release is published. See that step for why.
43+
vcs_release: "false"
4044

41-
- name: Publish | Upload to GitHub Release Assets
42-
uses: python-semantic-release/[email protected]
45+
# This repo has immutable releases enabled, which freezes a release's
46+
# assets the moment it is published, so assets cannot be attached
47+
# afterwards. `gh release create` handles this by creating the release as
48+
# a draft, uploading the assets, and only then publishing it:
49+
# https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/immutable-releases
50+
- name: Publish | Create GitHub Release with Assets
4351
if: steps.release.outputs.released == 'true'
44-
with:
45-
github_token: ${{ secrets.GITHUB_TOKEN }}
46-
tag: ${{ steps.release.outputs.tag }}
52+
env:
53+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
RELEASE_NOTES: ${{ steps.release.outputs.release_notes }}
55+
TAG: ${{ steps.release.outputs.tag }}
56+
run: |
57+
printf '%s' "$RELEASE_NOTES" > "$RUNNER_TEMP/release_notes.md"
58+
gh release create "$TAG" \
59+
--verify-tag \
60+
--title "$TAG" \
61+
--notes-file "$RUNNER_TEMP/release_notes.md" \
62+
dist/*
4763
4864
- name: Upload dist artifacts
4965
if: steps.release.outputs.released == 'true'

0 commit comments

Comments
 (0)