Skip to content

Create draft GitHub release automatically when a v* tag is pushed - #58

Merged
aylindmello merged 3 commits into
mainfrom
release-on-tag
Oct 30, 2026
Merged

aylindmello merged 3 commits into
mainfrom
release-on-tag

Conversation

@aylindmello

@aylindmello aylindmello commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Pushing a vX.Y.Z tag now builds the toolbox and creates a draft GitHub Release with the .mltbx attached. An admin reviews and publishes the draft.

Release process

  1. Tag and push from the command line:
    git tag v0.1.5
    git push origin v0.1.5
    
  2. CI runs test → package → release. The release job checks the tagged commit is on main, then creates a draft Release with auto-generated notes and writes the .mltbx SHA-256 to the job summary.
  3. An admin opens the draft under Releases, confirms the asset digest matches the job summary, edits the notes if needed, and clicks Publish.

Changes

  • buildfile.m: mltbx reads the toolbox version from TOOLBOX_VERSION, falling back to the latest vX.Y.Z git tag. The build errors (buildfile:NoToolboxVersion) if neither is available, instead of packaging a stale hardcoded version.
  • .github/workflows/matlab.yml:
    • package sets TOOLBOX_VERSION from the tag on tag builds, and checks out with fetch-depth: 0 so branch builds can find tags.
    • New release job (only on v* tags, after test and package pass) checks that the tagged commit is on main, then creates the draft Release.
  • CONTRIBUTING.md: new "Releasing" section documenting the admin-only release process.

Safety

  • A tag ruleset (all tags; creation/update/deletion restricted) limits tag creation to repository admins and org owners.
  • Fork pull requests can't trigger a release: the workflow uses pull_request, so fork runs get a read-only token and no secrets.
  • Immutable releases are enabled, so a published Release's tag and assets are locked. Publishing a draft is the point of no return; a bad draft can be deleted and the tag re-pushed.
  • Drafts can be edited by any user with write access, including replacing the asset. Compare the SHA-256 in the job summary against the asset digest before publishing.

Testing

  • Local buildtool mltbx: version 0.1.4 from the git tag, 9.9.9 when TOOLBOX_VERSION=9.9.9, and the expected error when git is unavailable.
  • Main-branch check: passes for v0.1.4, fails for a commit not on main.
  • The release job itself is untested until the first tag is pushed after merge.

🤖 Generated with Claude Code

- buildfile: derive toolbox version from TOOLBOX_VERSION, else the latest
  vX.Y.Z git tag; error if neither is available.
- CI: set TOOLBOX_VERSION from the tag, fetch full history in package so
  branch builds can find tags, and add a release job that verifies the
  tagged commit is on main before publishing the .mltbx.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@aylindmello aylindmello self-assigned this Oct 30, 2026
Published releases are immutable, so CI creates a draft with the .mltbx
attached and writes its SHA-256 to the job summary. An admin verifies the
asset digest and publishes the draft from the GitHub UI.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@aylindmello aylindmello changed the title Create GitHub release automatically when a v* tag is pushed Create draft GitHub release automatically when a v* tag is pushed Oct 30, 2026
@jhughes-dev

Copy link
Copy Markdown
Collaborator

looks good. no flags

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@aylindmello aylindmello reopened this Oct 30, 2026
@aylindmello

Copy link
Copy Markdown
Collaborator Author

(Closed and reopened since GitHub wasn't picking up the latest commit.)

@aylindmello
aylindmello merged commit b58a95d into main Oct 30, 2026
8 checks passed
@aylindmello
aylindmello deleted the release-on-tag branch October 30, 2026 14:36
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