Skip to content

fix: make release workflow compatible with immutable releases - #290

Open
farhan wants to merge 1 commit into
openedx:masterfrom
farhan:farhan/modernize-release-workflow
Open

fix: make release workflow compatible with immutable releases#290
farhan wants to merge 1 commit into
openedx:masterfrom
farhan:farhan/modernize-release-workflow

Conversation

@farhan

@farhan farhan commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

What changed

Updates .github/workflows/release.yml to match the current sample-plugin release standard, adapted for forum (single backend package, dist/ at repo root, OIDC PyPI publishing preserved).

Relevant PR: https://github.com/openedx/sample-plugin/pull/57/changes

Why

The previous workflow attached release assets with python-semantic-release/publish-action, which fails with HTTP 422 once a GitHub Release is frozen on publish (immutable releases). The new standard avoids this by building the release as a draft first.

Details

  • Immutable-releases draft pattern: set vcs_release: "false" on python-semantic-release so it commits, tags, pushes, and builds but does not create the GitHub Release. The release is then created via gh release create --verify-tag as a draft, assets uploaded, and only then published — so assets attach reliably.
  • Corrected SHA version-comment mismatches: the old pins carried wrong version comments (upload-artifact SHA was really v4.6.2, not v7.0.1; download-artifact SHA was really v4.3.0, not v8.0.1) and pinned python-semantic-release to the annotated-tag object SHA rather than the commit SHA. Now pinned to commit SHAs with accurate comments.
  • Action bumps: actions/checkout → v6.0.2, pypa/gh-action-pypi-publish → v1.14.0.
  • PyPI publishing keeps OIDC trusted publishing (no API token) — added contents: read alongside id-token: write for least privilege.

Notes

The multi-component jobs in sample-plugin (tutor plugin, npm/frontend publish) do not apply to forum and were intentionally omitted.

🤖 Generated with Claude Code

@farhan farhan self-assigned this Sep 1, 2026
@farhan
farhan marked this pull request as ready for review September 1, 2026 06:28
@farhan
farhan requested a review from feanil September 1, 2026 07:18
@irfanuddinahmad

Copy link
Copy Markdown
Contributor

Since this repo is already uv-native (uv.lock/pyproject.toml), consider going one step further: run PSR via uvx instead of this Docker action, and switch build_command to uv build:

uvx --from "python-semantic-release==10.6.2" \
  semantic-release -v version --no-changelog --no-vcs-release

Avoids pip entirely (in line with the org's uv migration) and is ~2.5-3x faster per run in our testing — PSR's Docker image rebuilds from scratch every run (~40s overhead) vs uvx's ~1s. Non-blocking, up to you whether it's in scope for this PR.

The org has immutable releases enabled, which freezes a release's assets
the moment it is published. The old flow let python-semantic-release
publish the GitHub Release and then attached the built distributions
afterwards via publish-action, which now fails with HTTP 422 ("cannot
upload assets to an immutable release"). That failure aborts the release
job before publish_to_pypi runs, so the tag is created but the package is
never shipped.

Adopt the sample-plugin immutable-safe pattern: set vcs_release="false"
so python-semantic-release commits, tags, and builds but does not publish
the release, then create it with `gh release create` which uploads the
assets to a draft and publishes it atomically -- the ordering immutable
releases require. All actions are SHA-pinned to their latest releases
with matching version comments (checkout v7.0.1, upload-artifact v7.0.1,
download-artifact v8.0.1, python-semantic-release v10.6.2,
gh-action-pypi-publish v1.14.2). PyPI keeps OIDC trusted publishing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@farhan farhan changed the title build: align release workflow with sample-plugin standard fix: make release workflow compatible with immutable releases Sep 1, 2026
@farhan
farhan force-pushed the farhan/modernize-release-workflow branch from 2b53564 to 6a4135f Compare September 1, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants