Repository navigation
Plan: Publish ponyup releases to both Cloudsmith and GitHub Releases #406
Closed
SeanTAllen
started this conversation in
Research
Replies: 1 comment
|
Implemented and verified live across ponyup, corral, and ponyc. release-bot-action gained the |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Relevant principles
Divergences from today
X.Y.Z(created byannounce-a-release.yml) has release notes but no binaries.release.ymlwith an empty body;announce-a-release.ymlfills in the body later. Safe becausepublish-release-notes-to-githubusesupdate_release(name, message)and does not touch assets.publish-release-notes-to-githubnow marks the release as GitHub's "latest" (make_latest=True) when it publishes notes. Today it doesn't — an oversight that needs fixing so future ponyup (and other ponylang consumers) can rely on the GitHub-Releases "latest" designation when pulling binaries from GH Releases.ponyup-init.sh/.ps1: unchanged.Work split into two PRs
Create-release logic lives in
release-bot-action(the existing ponylang pattern for release automation;pre-artefact-creationalready uses it, docker action works fine on the Linuxubuntu-latestrunner). Asset-upload logic lives in ponyup (must run on macOS and Windows, where docker actions can't; stays in ponyup until a second consumer justifies a shared action repo).The release-bot-action change ships first as its own PR and tag. The ponyup change consumes the new tag.
PR 1 —
ponylang/release-bot-action: new entrypoint +make_latestfixNew script:
scripts/create-empty-github-releaseRELEASE_TOKEN,GITHUB_REF,GITHUB_REPOSITORY. Same validation pattern aspublish-release-notes-to-github.versionfromGITHUB_REF(strippingrefs/tags/).repo.get_release(version):announce-a-release.ymlrun (restart-after-announce case) and any assets uploaded by a priorrelease.ymlrun.repo.create_git_release(tag=version, name=version, message="", draft=False, prerelease=False). Note:make_latestis intentionally not set here — the latest flag is deferred until notes are published, so we never have a period where an empty-body release is marked "latest."GithubException: print status + message to stderr, exit 1.Existing script change:
scripts/publish-release-notes-to-githubmake_latest="true"toupdate_release.make_latest="true"tocreate_git_release.Apply-to-all consequence: every repo currently consuming release-bot-action (~40 repos) will start getting
make_latest=trueon its next release. This is the desired behavior.action.ymlRegister
create-empty-github-releaseas a new entrypoint alongside the existing ones (publish-release-notes-to-github,pre-artefact-changelog-check, etc.).Docs + release
CHANGELOG.md/.release-notes/next-release.mdin release-bot-action: two entries.create-empty-github-releaseentrypoint for creating a GitHub release with empty body as part of pre-artefact-creation.publish-release-notes-to-githubnow marks the release as GitHub's "latest release."0.6.6) after merge.changelog - addedandchangelog - fixedboth apply — since this PR contains multiple change types, skip the labels and update the CHANGELOG manually per global convention.Scope outside this PR
make_latestaddition.PR 2 —
ponylang/ponyup: consume the new entrypoint + upload assetsUpload mechanism: python script
Location:
.ci-scripts/release/github_release.py. Stdlib only —urllib.request,json,os,sys. No pip install on any runner.Subcommand
python3 github_release.py upload <tag> <file>GET https://api.github.com/repos/{GITHUB_REPOSITORY}/releases/tags/{tag}→ extractidandassets.name == basename(file)exists:DELETE https://api.github.com/repos/{GITHUB_REPOSITORY}/releases/assets/{asset_id}. Known failure mode: DELETE succeeds but subsequent POST fails — release is left missing that asset. Accepted because restart (re-pushingX.Y.Z) reconverges and a missing asset is not worse than a half-uploaded one.POST https://uploads.github.com/repos/{GITHUB_REPOSITORY}/releases/{release_id}/assets?name={basename(file)}with body = file bytes,Content-Type: application/octet-stream(uniform across.tar.gzand.zip; GitHub accepts this for any asset type). On 2xx, exit 0.Only one subcommand — release creation is handled by release-bot-action's new entrypoint (PR 1), not this script.
Auth + env
GITHUB_TOKEN(auth),GITHUB_REPOSITORY(owner/repo).Authorization: Bearer ${GITHUB_TOKEN}on every request.Accept: application/vnd.github+jsonon API requests.X-GitHub-Api-Version: 2022-11-28on every request.Tradeoff noted
When a second ponylang repo needs the same capability, lift the script into a dedicated action repo. For now, one consumer, one copy.
Workflow changes —
release.ymlpre-artefact-creationBump the release-bot-action version used by this job (and other jobs using release-bot-action) to the new tag from PR 1 — e.g.,
0.6.6. Add a new step afterValidate CHANGELOG:Inline YAML comment above the step documenting that the release is created empty so platform jobs can attach assets, and that
announce-a-release.ymlwill populate the body (and setmake_latest) viapublish-release-notes-to-github, which does not touch assets.Other
release-bot-actionusages inrelease.ymlandannounce-a-release.ymlare bumped to the same new tag in this PR to keep the repo on one version.Platform jobs — the 4
*-release.bashscripts (Linux + macOS)For each of
arm64-unknown-linux-release.bash,x86-64-unknown-linux-release.bash,x86-64-apple-darwin-release.bash,arm64-apple-darwin-release.bash:GITHUB_TOKENenv-var validation near the existingCLOUDSMITH_API_KEYvalidation block.APPLICATION_VERSIONis already$(cat VERSION)— no new computation.cloudsmith push rawcall, add:Platform jobs — Windows inline PowerShell
The two Windows jobs have no
.bashscript — upload is inline inrelease.yml. Append after thecloudsmith push raw …line. Windows archive paths are hardcoded in the workflow:build\ponyup-x86-64-pc-windows-msvc.zipbuild\ponyup-arm64-pc-windows-msvc.zipAppend to each Windows job's
run:block:Add to the step's
env:block:Job display names
The six platform job
name:fields currently read "Build and upload ... to Cloudsmith". These become stale. Update each to "Build and upload ..." (dropping "to Cloudsmith") — the step output shows both destinations.Per-job env plumbing for the upload step
Write permission for releases is already granted at workflow scope (
contents: write); no per-job override needed.GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}andGITHUB_REPOSITORY: ${{ github.repository }}to theenv:block of the "Build and upload" step.docker run): add-e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}to thedocker runinvocation (alongside the existing-e GITHUB_REPOSITORY).env:block.Workflow changes —
announce-a-release.ymlNo logic changes. Bump the release-bot-action tag if not already bumped by the
release.ymlchange in this PR. Add a short YAML comment above theRelease notesstep documenting the contract: the GitHub Release is pre-created byrelease.ymlwith assets attached; this step must update-not-replace (and setsmake_latest), or assets are dropped. Principle-11 comment at the breakage site.Python 3 availability verification
Python 3 is preinstalled on all GitHub-hosted runners. The only environment not under GitHub's control is
ghcr.io/ponylang/shared-docker-ci-standard-builder-with-libressl-4.2.0.Pre-implementation prerequisite (before opening PR 2): run
docker run --rm ghcr.io/ponylang/shared-docker-ci-standard-builder-with-libressl-4.2.0:release python3 --version. Two outcomes:apk add python3orapt-get install -y python3).Restart behavior
X.Y.Z: the new entrypoint no-ops (release exists, body and latest-flag preserved). Platform jobs re-upload with delete-then-POST clobber.announce-a-release.ymlis independent and leaves assets alone; each run setsmake_latest=true.announce-X.Y.Zwithout priorX.Y.Z:publish-release-notes-to-github'screate_git_releasebranch creates a release with notes andmake_latest=truebut no binaries. Same shape as today, now additionally correct on the latest flag.Docs + changelog
RELEASE_PROCESS.md: expand "Build artifacts" to state publishing destinations (Cloudsmith + GH Releases) and that restart via re-pushingX.Y.Zconverges safely..release-notes/next-release.md(currently empty): add "Added" entry — "Release binaries are now published to GitHub Releases in addition to Cloudsmith."CHANGELOG.md: no manual edit. Applychangelog - addedPR label; automation handles the update on merge (single change type in ponyup).README.mdaudit: scan for install-source references that would mislead now that GH Releases is equivalent. "No change needed" is an acceptable outcome.Verification
No automated workflow-behavior test is possible. On the next release:
release.ymlfor upload-step failures.X.Y.Zhas 6 archives after platform jobs finish.announce-a-release.ymlpopulates the body, sets the release as "latest," and assets remain attached.PR 2 structure
publish-releases-to-github. Squash before opening. Commit message explains why, not what. No Test plan section in the PR body.changelog - added.Open items
None pending. Settled: each-platform-job-uploads, publish immediately, defer checksums, create-step in release-bot-action, upload-script in ponyup,
make_latestfix in release-bot-action's notes script, two-PR sequencing.All reactions