Skip to content

Commit 343bdc6

Browse files
fix: create GitHub release with assets attached, not after publish
This repo has immutable releases enabled, which freezes a release's assets the moment it's published. Previously this workflow didn't even attempt to attach dist files to the GitHub release (relying only on the actions/upload-artifact -> download-artifact path for PyPI publish), so every release shipped with an empty GitHub Release page. Matches the fix already proven on openedx/sample-plugin#57 and validated end-to-end on openedx/event-tracking#434: build without publishing (vcs_release: false), then create the release with dist/* attached in one gh release create call. Not adding the separate gitpython/uv workaround from event-tracking#435/#436 here -- these PRs won't merge until upstream python-semantic-release fixes the GitPython 3.1.60 break (python-semantic-release/python-semantic-release#1476).
1 parent cc8b436 commit 343bdc6

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,29 @@ jobs:
4040
git_committer_name: "github-actions"
4141
git_committer_email: "[email protected]"
4242
changelog: "false"
43+
# Commit, tag, push and build, but don't create the GitHub release.
44+
# We create it ourselves in the next step so that the distributions
45+
# are attached before the release is published. See that step for why.
46+
vcs_release: "false"
47+
48+
# This repo has immutable releases enabled, which freezes a release's
49+
# assets the moment it is published, so assets cannot be attached
50+
# afterwards. `gh release create` handles this by creating the release as
51+
# a draft, uploading the assets, and only then publishing it:
52+
# https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/immutable-releases
53+
- name: Publish | Create GitHub Release with Assets
54+
if: steps.release.outputs.released == 'true'
55+
env:
56+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
RELEASE_NOTES: ${{ steps.release.outputs.release_notes }}
58+
TAG: ${{ steps.release.outputs.tag }}
59+
run: |
60+
printf '%s' "$RELEASE_NOTES" > "$RUNNER_TEMP/release_notes.md"
61+
gh release create "$TAG" \
62+
--verify-tag \
63+
--title "$TAG" \
64+
--notes-file "$RUNNER_TEMP/release_notes.md" \
65+
dist/*
4366
4467
- name: Upload dist artifacts
4568
if: steps.release.outputs.released == 'true'

0 commit comments

Comments
 (0)