fix(release): publish release drafter notes

This commit is contained in:
Vincent Koc 2026-04-22 23:18:21 -07:00
parent e5764220b2
commit c30546785f
No known key found for this signature in database
4 changed files with 62 additions and 20 deletions

View File

@ -66,6 +66,12 @@ autolabeler:
- label: "feat"
title:
- '/^feat(\(.+\))?:/i'
- label: "feature"
title:
- '/^feature(\(.+\))?:/i'
- label: "enhancement"
title:
- '/^enhancement(\(.+\))?:/i'
- label: "fix"
title:
- '/^fix(\(.+\))?:/i'
@ -90,15 +96,21 @@ autolabeler:
- label: "test"
title:
- '/^test(\(.+\))?:/i'
- label: "tests"
title:
- '/^tests(\(.+\))?:/i'
- label: "chore"
title:
- '/^chore(\(.+\))?:/i'
- label: "dep"
title:
- '/^dep(\(.+\))?:/i'
- label: "deps"
title:
- '/^deps(\(.+\))?:/i'
- label: "dependencies"
title:
- '/^(dep|deps|dependencies)(\(.+\))?:/i'
- label: "other"
title:
- '/.*/'
- '/^dependencies(\(.+\))?:/i'
template: |
## notcrawl v$RESOLVED_VERSION

View File

@ -1,6 +1,9 @@
name: Release Drafter
on:
push:
branches:
- main
workflow_dispatch:
pull_request_target:
types:
@ -28,7 +31,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update_release_draft:
if: github.event_name == 'workflow_dispatch'
name: Update Release Draft
if: github.event_name != 'pull_request_target'
runs-on: ubuntu-latest
steps:
- name: Draft release notes

View File

@ -12,6 +12,7 @@ on:
type: string
permissions:
actions: write
contents: write
env:
@ -36,20 +37,50 @@ jobs:
- name: Run tests
run: go test ./...
- name: Build release notes
- name: Resolve release metadata
env:
TAG: ${{ inputs.tag_name || github.ref_name }}
run: scripts/release-notes.sh "${TAG}" > /tmp/release-notes.md
run: |
set -euo pipefail
if [[ ! "${TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z]+)*$ ]]; then
echo "Invalid release tag: ${TAG}"
exit 1
fi
echo "RELEASE_TAG=${TAG}" >> "$GITHUB_ENV"
echo "RELEASE_VERSION=${TAG#v}" >> "$GITHUB_ENV"
- name: Run GoReleaser
- name: Build release artifacts
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean --release-notes=/tmp/release-notes.md
args: release --clean --skip=publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish release from Release Drafter
uses: release-drafter/release-drafter@v7
with:
publish: true
tag: ${{ env.RELEASE_TAG }}
version: ${{ env.RELEASE_VERSION }}
name: "notcrawl ${{ env.RELEASE_TAG }}"
prerelease: ${{ contains(env.RELEASE_TAG, 'beta') || contains(env.RELEASE_TAG, 'alpha') || contains(env.RELEASE_TAG, 'rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
gh release upload "${RELEASE_TAG}" \
dist/*.tar.gz \
dist/*.deb \
dist/*.rpm \
dist/sha256sums.txt \
--clobber
- name: Evaluate Cloudsmith configuration
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}

View File

@ -8,7 +8,6 @@ Cloudsmith APT/RPM repositories.
```bash
go test ./...
go build ./cmd/notcrawl
make release-notes TAG=v0.1.0
```
If GoReleaser is installed:
@ -22,13 +21,9 @@ under `dist/` without publishing.
## Release Notes
Generate local notes from conventional commits:
```bash
scripts/release-notes.sh v0.1.0
```
GitHub also uses Release Drafter to label PRs and maintain draft release notes.
GitHub uses Release Drafter to auto-label PRs and generate release notes from
merged pull requests. The release workflow publishes the Release Drafter output
for the pushed tag, then uploads the GoReleaser artifacts to that release.
## Tagged Release
@ -42,9 +37,9 @@ git push origin v0.1.0
The release workflow:
1. runs tests
2. generates release notes
3. builds GoReleaser artifacts
4. publishes GitHub release assets
2. builds GoReleaser artifacts
3. publishes Release Drafter notes for the tag
4. uploads GitHub release assets
5. optionally publishes APT/RPM packages to Cloudsmith
6. updates the Homebrew tap