Skip to content

ci: publish a GitHub Release automatically on version tags - #7

Merged
oswaldom-code merged 1 commit into
mainfrom
develop
Aug 5, 2026
Merged

ci: publish a GitHub Release automatically on version tags#7
oswaldom-code merged 1 commit into
mainfrom
develop

Conversation

@oswaldom-code

Copy link
Copy Markdown
Owner

Summary

Pushing a version tag created the module version but never a GitHub Release. The result was a repo front page still advertising the previous version while proxy.golang.org already served the new one — v0.2.0 sat in exactly that gap until the Release was published by hand.

This adds a workflow that closes it: push a v* tag, get a Release.

How it works

Triggers on push of tags matching v*, extracts the notes from the matching CHANGELOG.md section, and publishes with gh release create.

on:
  push:
    tags: ['v*']

Three deliberate choices:

It fails when the CHANGELOG has no matching section. Tagging v0.3.0 without a ## [0.3.0] heading turns the job red with an actionable message rather than publishing an empty Release. A missing changelog entry should block the release, not be papered over.

Tags containing a hyphen are marked --prerelease. A v1.0.0-rc1 will not steal the Latest badge from the current stable version. Everything else gets --latest.

No third-party action. Uses the gh CLI already present on the runner with github.token and permissions: contents: write. Consistent with the zero-dependency posture of the library itself — one less third party with write access to releases.

Verification

The awk extraction was run locally against the real CHANGELOG.md:

  • 0.2.0 — returns the full section, stops correctly at the next ## [ heading.
  • 0.1.0 — the last section in the file; stops at the link-reference definitions in the footer instead of swallowing them.
  • 9.9.9 — returns 0 bytes, so the job fails as intended.

YAML validated.

Note on scope

The workflow is unproven end to end: v0.2.0 was released manually before it existed, so its first real execution will be the next tag. It also cannot fire retroactively — on a tag push GitHub reads the workflow from the commit the tag points at, so this has to be on main before the next tag is created, not after.

Pushing a tag created the module version but never the Release, so the repo
front page kept advertising the previous version while proxy.golang.org
already served the new one. v0.2.0 hit exactly that gap.

Triggers on tags matching v*, takes the release notes from the matching
CHANGELOG section, and fails loudly if that section is missing rather than
publishing an empty release. Tags containing a hyphen are marked prerelease
so a release candidate never steals the Latest badge.

Uses the preinstalled gh CLI with the job token, no third-party action.
@oswaldom-code
oswaldom-code merged commit 3552bd1 into main Aug 5, 2026
7 checks passed
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.

1 participant