From 35c2e6466d3d10704a771a769c380a6486706f14 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 30 Sep 2026 17:41:44 +0000 Subject: [PATCH 1/2] Restore tag-triggered releases with validated notes --- .github/workflows/release.yml | 31 +++++++++++++++++++++++++------ .goreleaser.yml | 3 --- README.dev.md | 16 ++++++++++++++++ dev-bin/release.sh | 10 ++++++++-- 4 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 README.dev.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f1a50a7..48a517b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,14 +6,15 @@ on: push: branches: - main - release: - types: - - published + tags: + - 'v*' + +permissions: {} jobs: goreleaser-check: name: Check GoReleaser - if: github.event_name != 'release' + if: github.ref_type != 'tag' runs-on: ubuntu-latest permissions: contents: read @@ -40,7 +41,7 @@ jobs: goreleaser: name: Release with GoReleaser - if: github.event_name == 'release' && github.event.action == 'published' + if: github.event_name == 'push' && github.ref_type == 'tag' runs-on: ubuntu-latest environment: release permissions: @@ -53,6 +54,23 @@ jobs: submodules: recursive persist-credentials: false + # On a tag push, actions/checkout replaces the annotated tag with a + # lightweight tag. Fetch the tags again to get the tag message. + - name: Fetch annotated tags + run: git fetch --force --tags + + - name: Get release notes from the tag + run: | + if [ "$(git cat-file -t "refs/tags/$GITHUB_REF_NAME")" != tag ]; then + echo "Tag $GITHUB_REF_NAME is not an annotated tag. Create it with dev-bin/release.sh." + exit 1 + fi + git tag -l --format='%(contents:body)' "$GITHUB_REF_NAME" > "$RUNNER_TEMP/release-notes.md" + if ! grep -q '[^[:space:]]' "$RUNNER_TEMP/release-notes.md"; then + echo "Tag $GITHUB_REF_NAME has no release notes. Create it with dev-bin/release.sh." + exit 1 + fi + - name: Set up Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: @@ -64,6 +82,7 @@ jobs: with: distribution: goreleaser version: latest - args: release --clean + args: release --clean --release-notes ${{ runner.temp }}/release-notes.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GORELEASER_CURRENT_TAG: ${{ github.ref_name }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 4caf142..e9c44fb 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -44,9 +44,6 @@ checksum: snapshot: version_template: "{{ .Tag }}-next" -changelog: - disable: true - nfpms: - id: 'mmdbconvert' ids: diff --git a/README.dev.md b/README.dev.md new file mode 100644 index 0000000..b4f492d --- /dev/null +++ b/README.dev.md @@ -0,0 +1,16 @@ +# Releasing + +- Install `bash`, `git`, `go`, `gh`, and `sed`. Authenticate with + `gh auth login` and ensure your Git credentials can push to the repository. +- Create a release branch from `main`. +- Update the version, date, and notes in `CHANGELOG.md`. Use the format + `## [0.2.2] - YYYY-MM-DD` with today's date and a semantic version. +- Commit the changes. +- Run `dev-bin/release.sh` and review the version and notes before confirming. + The script pushes the branch, then pushes an annotated tag containing the + release notes. +- An authorized releaser must approve the Release workflow's pending deployment. + GoReleaser uploads the binaries and packages to a draft release, then + publishes it with the notes from the tag. +- Verify the assets and notes on the GitHub Releases page. +- Open a PR for the release branch and get it merged. diff --git a/dev-bin/release.sh b/dev-bin/release.sh index 1387f7d..5d6df24 100755 --- a/dev-bin/release.sh +++ b/dev-bin/release.sh @@ -63,6 +63,11 @@ date="${BASH_REMATCH[3]}" notes="$(echo "${BASH_REMATCH[4]}" | sed -n -E '/^## \[?[0-9]+\.[0-9]+\.[0-9]+/,$!p')" tag="v$version" +if ! grep -q '[^[:space:]]' <<<"$notes"; then + echo "Release notes for $tag are empty. Add notes to CHANGELOG.md." >&2 + exit 1 +fi + if [[ "$date" != "$(date +"%Y-%m-%d")" ]]; then echo "$date is not today!" exit 1 @@ -95,6 +100,7 @@ message="$version $notes" -git tag -a -m "$message" "$tag" +# "whitespace" keeps Markdown headings and adds a newline before a signature. +git tag -a --cleanup=whitespace -m "$message" "$tag" -git push --tags +git push origin "refs/tags/$tag" From e6e0fd409845d8b9dc8ec01818a7c67449c46a3c Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 30 Sep 2026 17:50:46 +0000 Subject: [PATCH 2/2] Update mmdbwriter to the latest development version Upgrade maxminddb-golang to v2.7.0 as required by mmdbwriter. --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 9bfeda3..cd48fed 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/maxmind/mmdbconvert go 1.27.0 require ( - github.com/maxmind/mmdbwriter/v2 v2.0.0-20260928214421-cc514d224474 - github.com/oschwald/maxminddb-golang/v2 v2.6.0 + github.com/maxmind/mmdbwriter/v2 v2.0.0-20260929214414-aa874fe6bc9e + github.com/oschwald/maxminddb-golang/v2 v2.7.0 github.com/parquet-go/parquet-go v0.32.0 github.com/pelletier/go-toml/v2 v2.4.3 github.com/stretchr/testify v1.12.1 diff --git a/go.sum b/go.sum index d5d875e..622e08d 100644 --- a/go.sum +++ b/go.sum @@ -14,10 +14,10 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uqnapk= github.com/klauspost/compress v1.18.2/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4= -github.com/maxmind/mmdbwriter/v2 v2.0.0-20260928214421-cc514d224474 h1:g1xsksNM6TU0WRdd+EexImVGW1ffFy4XFVLI6Rx6LKE= -github.com/maxmind/mmdbwriter/v2 v2.0.0-20260928214421-cc514d224474/go.mod h1:hPQyr0pfn16zAHNQsUS9w4SHjBZ/Y8+Jfmf04SS1K8A= -github.com/oschwald/maxminddb-golang/v2 v2.6.0 h1:pRlHCdJmc+4uxMOSthmKDt5HOw3JTX8TJZlhyP5ew0w= -github.com/oschwald/maxminddb-golang/v2 v2.6.0/go.mod h1:sjqpB3z2BZrMduDp9TAUTCkZDoT3nDhixUc4Dge2qRQ= +github.com/maxmind/mmdbwriter/v2 v2.0.0-20260929214414-aa874fe6bc9e h1:tFFxMqYvIZ6Z4sdOf+KlKHeMQ7Y4PA/bCSOH6s5XWyY= +github.com/maxmind/mmdbwriter/v2 v2.0.0-20260929214414-aa874fe6bc9e/go.mod h1:wgHnsdUYfQeQZI6xWn4Ix7zt1b9/Wi5Q9JJMFa1jZDk= +github.com/oschwald/maxminddb-golang/v2 v2.7.0 h1:ZcAr3GYc2LYC8aec2mCMX9+QOF0EolH3jDFKRV/Z1+U= +github.com/oschwald/maxminddb-golang/v2 v2.7.0/go.mod h1:DuKJLbbug6TXC0yJXgs1MWifvXHmudRWzMobMIUu04g= github.com/parquet-go/bitpack v1.0.0 h1:AUqzlKzPPXf2bCdjfj4sTeacrUwsT7NlcYDMUQxPcQA= github.com/parquet-go/bitpack v1.0.0/go.mod h1:XnVk9TH+O40eOOmvpAVZ7K2ocQFrQwysLMnc6M/8lgs= github.com/parquet-go/jsonlite v1.2.0 h1:vr/BuNlMOiUME/uhsTS2xAQL26B+cnfDJBHSQN0z+qI=