chore: add release note generation

This commit is contained in:
Vincent Koc 2026-04-22 16:29:09 -07:00
parent 9ba467de49
commit eed2d38bba
No known key found for this signature in database
4 changed files with 194 additions and 1 deletions

112
.github/release-drafter.yml vendored Normal file
View File

@ -0,0 +1,112 @@
name-template: "notioncrawl v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
change-template: "- $TITLE (#$NUMBER) @$AUTHOR"
change-title-escapes: '\<*_&'
no-changes-template: "- No merged pull requests in this release."
categories:
- title: "Features"
labels:
- "feature"
- "enhancement"
- "feat"
- title: "Fixes"
labels:
- "bug"
- "fix"
- title: "Maintenance"
labels:
- "perf"
- "chore"
- "ci"
- "build"
- "dependencies"
- "dep"
- "deps"
- "docs"
- "refactor"
- "test"
- "tests"
- title: "Other Changes"
labels:
- "other"
exclude-labels:
- "skip-changelog"
- "no-changelog"
version-resolver:
major:
labels:
- "major"
minor:
labels:
- "feat"
- "feature"
- "enhancement"
patch:
labels:
- "bug"
- "fix"
- "perf"
- "chore"
- "ci"
- "build"
- "dependencies"
- "dep"
- "deps"
- "docs"
- "refactor"
- "test"
- "tests"
- "other"
default: patch
autolabeler:
- label: "feat"
title:
- '/^feat(\(.+\))?:/i'
- label: "fix"
title:
- '/^fix(\(.+\))?:/i'
- label: "bug"
title:
- '/^bug(\(.+\))?:/i'
- label: "perf"
title:
- '/^perf(\(.+\))?:/i'
- label: "refactor"
title:
- '/^refactor(\(.+\))?:/i'
- label: "docs"
title:
- '/^docs(\(.+\))?:/i'
- label: "build"
title:
- '/^build(\(.+\))?:/i'
- label: "ci"
title:
- '/^ci(\(.+\))?:/i'
- label: "test"
title:
- '/^test(\(.+\))?:/i'
- label: "chore"
title:
- '/^chore(\(.+\))?:/i'
- label: "dependencies"
title:
- '/^(dep|deps|dependencies)(\(.+\))?:/i'
- label: "other"
title:
- '/.*/'
template: |
## notioncrawl v$RESOLVED_VERSION
local-first Notion crawling into SQLite, normalized Markdown, and git-backed snapshots.
### what's new
$CHANGES
### contributors
$CONTRIBUTORS

34
.github/workflows/release-drafter.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: Release Drafter
on:
workflow_dispatch:
pull_request_target:
types:
- opened
- reopened
- synchronize
- edited
- ready_for_review
permissions:
contents: write
pull-requests: write
jobs:
autolabel:
if: github.event_name == 'pull_request_target'
runs-on: ubuntu-latest
steps:
- name: Autolabel pull request
uses: release-drafter/release-drafter/autolabeler@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update_release_draft:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Draft release notes
uses: release-drafter/release-drafter@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,6 +1,6 @@
BINARY ?= bin/notioncrawl
.PHONY: build test run fmt
.PHONY: build test run fmt release-notes
build:
go build -o $(BINARY) ./cmd/notioncrawl
@ -13,3 +13,7 @@ run:
fmt:
gofmt -w $$(find . -name '*.go' -not -path './.git/*')
release-notes:
@test -n "$(TAG)" || (echo "usage: make release-notes TAG=v0.1.0" >&2; exit 2)
scripts/release-notes.sh "$(TAG)"

43
scripts/release-notes.sh Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -euo pipefail
tag="${1:-}"
range="${2:-}"
if [ -z "${tag}" ]; then
echo "usage: scripts/release-notes.sh v0.1.0 [git-range]" >&2
exit 2
fi
if [ -z "${range}" ]; then
previous="$(git describe --tags --abbrev=0 2>/dev/null || true)"
if [ -n "${previous}" ]; then
range="${previous}..HEAD"
else
range="HEAD"
fi
fi
version="${tag#v}"
section() {
local title="$1"
local pattern="$2"
local lines
lines="$(git log --format='%s' "${range}" | grep -Ei "${pattern}" || true)"
if [ -z "${lines}" ]; then
return
fi
printf '\n### %s\n\n' "${title}"
printf '%s\n' "${lines}" | sed -E 's/^[a-z]+(\([^)]+\))?!?:[[:space:]]*/- /I'
}
cat <<EOF
## notioncrawl v${version}
local-first Notion crawling into SQLite, normalized Markdown, and git-backed snapshots.
EOF
section "Features" '^(feat|feature|enhancement)(\([^)]+\))?!?:'
section "Fixes" '^(fix|bug)(\([^)]+\))?!?:'
section "Maintenance" '^(chore|ci|build|docs|refactor|test|perf|dep|deps|dependencies)(\([^)]+\))?!?:'