5 Commits

Author SHA1 Message Date
Micheal Wilkinson
2646d42523 feat: default to release-version file
Some checks failed
Action Validation / validate-released-binary (amd64, ./vociferate, X64) (push) Failing after 6s
Action Validation / validate-released-binary (arm64, qemu-aarch64-static ./vociferate, ARM64) (push) Failing after 23s
Push Validation / validate (push) Successful in 52s
2026-03-20 19:32:49 +00:00
Micheal Wilkinson
a413385c4e feat: cache release binary in action 2026-03-20 19:28:02 +00:00
Micheal Wilkinson
5cb0010531 chore: make releases workflow-only 2026-03-20 19:23:43 +00:00
Micheal Wilkinson
fd7660721a docs(changelog): Revert aborted 1.0 release 2026-03-20 19:18:53 +00:00
Micheal Wilkinson
8fefbf1997 refactor: rename releaseprep to vociferate 2026-03-20 19:16:51 +00:00
13 changed files with 306 additions and 126 deletions

View File

@@ -0,0 +1,102 @@
name: Action Validation
on:
push:
branches:
- "**"
tags-ignore:
- "*"
workflow_dispatch:
jobs:
validate-released-binary:
runs-on: ubuntu-latest
container: docker.io/catthehacker/ubuntu:act-latest
strategy:
fail-fast: false
matrix:
include:
- runner_arch: X64
asset_arch: amd64
run_command: ./vociferate
- runner_arch: ARM64
asset_arch: arm64
run_command: qemu-aarch64-static ./vociferate
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install arm64 emulator
if: ${{ matrix.runner_arch == 'ARM64' }}
run: |
set -euo pipefail
apt-get update
apt-get install -y qemu-user-static
- name: Resolve latest released binary
id: resolve-binary
env:
API_URL: ${{ github.api_url }}
SERVER_URL: ${{ github.server_url }}
TOKEN: ${{ github.token }}
ASSET_ARCH: ${{ matrix.asset_arch }}
run: |
set -euo pipefail
release_tag="$(curl -fsSL \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
"${API_URL}/repos/aether/vociferate/releases/latest" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n 1)"
if [[ -z "$release_tag" ]]; then
echo "Unable to resolve latest vociferate release" >&2
exit 1
fi
normalized_version="${release_tag#v}"
asset_name="vociferate_${normalized_version}_linux_${ASSET_ARCH}"
asset_url="${SERVER_URL}/aether/vociferate/releases/download/${release_tag}/${asset_name}"
echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT"
echo "asset_name=$asset_name" >> "$GITHUB_OUTPUT"
echo "asset_url=$asset_url" >> "$GITHUB_OUTPUT"
- name: Download released binary
env:
TOKEN: ${{ github.token }}
ASSET_URL: ${{ steps.resolve-binary.outputs.asset_url }}
run: |
set -euo pipefail
curl --fail --location \
-H "Authorization: token ${TOKEN}" \
-o vociferate \
"$ASSET_URL"
chmod +x vociferate
- name: Smoke test released binary
env:
RUN_COMMAND: ${{ matrix.run_command }}
run: |
set -euo pipefail
recommended_tag="$($RUN_COMMAND --recommend --root .)"
case "$recommended_tag" in
v*.*.*)
;;
*)
echo "Unexpected recommended tag: $recommended_tag" >&2
exit 1
;;
esac
{
echo "## Released Binary Validation"
echo
echo "- Release tag: ${{ steps.resolve-binary.outputs.release_tag }}"
echo "- Asset: ${{ steps.resolve-binary.outputs.asset_name }}"
echo "- Recommended tag: ${recommended_tag}"
} >> "$GITHUB_STEP_SUMMARY"

View File

@@ -4,13 +4,14 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
version: version:
description: Semantic version to release, with or without leading v. description: Optional semantic version override, with or without leading v. When omitted, the recommended version is used.
required: true required: false
workflow_call: workflow_call:
inputs: inputs:
version: version:
description: Semantic version to release, with or without leading v. description: Optional semantic version override, with or without leading v. When omitted, the recommended version is used.
required: true required: false
default: ''
type: string type: string
jobs: jobs:
@@ -36,12 +37,36 @@ jobs:
cache: true cache: true
cache-dependency-path: go.sum cache-dependency-path: go.sum
- name: Prepare release files - name: Resolve release version
id: resolve-version
env: env:
RELEASE_VERSION: ${{ inputs.version }} INPUT_VERSION: ${{ inputs.version }}
run: | run: |
set -euo pipefail set -euo pipefail
./script/prepare-release.sh "$RELEASE_VERSION"
provided_version="$(printf '%s' "${INPUT_VERSION:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
if [[ -n "$provided_version" ]]; then
release_version="$provided_version"
else
if ! release_version="$(go run ./cmd/vociferate --recommend --root . 2>release-recommendation.err)"; then
recommendation_error="$(tr '\n' ' ' < release-recommendation.err | sed 's/[[:space:]]\+/ /g' | sed 's/^ //; s/ $//')"
echo "Resolve release version: ${recommendation_error}" >&2
exit 1
fi
fi
echo "RELEASE_VERSION=$release_version" >> "$GITHUB_ENV"
echo "version=$release_version" >> "$GITHUB_OUTPUT"
- name: Prepare release files
run: |
set -euo pipefail
go run ./cmd/vociferate \
--root . \
--version "$RELEASE_VERSION" \
--date "$(date -u +%F)" \
--changelog changelog.md
- name: Run tests - name: Run tests
run: | run: |
@@ -55,8 +80,6 @@ jobs:
git config user.email "gitea-actions[bot]@users.noreply.local" git config user.email "gitea-actions[bot]@users.noreply.local"
- name: Commit release changes and push tag - name: Commit release changes and push tag
env:
RELEASE_VERSION: ${{ inputs.version }}
run: | run: |
set -euo pipefail set -euo pipefail
@@ -82,15 +105,13 @@ jobs:
esac esac
git remote set-url origin "$authed_remote" git remote set-url origin "$authed_remote"
git add changelog.md internal/releaseprep/version/version.go git add changelog.md release-version
git commit -m "release: prepare ${tag}" git commit -m "release: prepare ${tag}"
git tag "$tag" git tag "$tag"
git push origin HEAD git push origin HEAD
git push origin "$tag" git push origin "$tag"
- name: Create release with changelog notes - name: Create release with changelog notes
env:
RELEASE_VERSION: ${{ inputs.version }}
run: | run: |
set -euo pipefail set -euo pipefail
@@ -158,24 +179,18 @@ jobs:
echo "RELEASE_ID=$release_id" >> "$GITHUB_ENV" echo "RELEASE_ID=$release_id" >> "$GITHUB_ENV"
- name: Build release binaries - name: Build release binaries
env:
RELEASE_VERSION: ${{ inputs.version }}
run: | run: |
set -euo pipefail set -euo pipefail
normalized_version="${RELEASE_VERSION#v}" normalized_version="${RELEASE_VERSION#v}"
mkdir -p dist mkdir -p dist
for target in darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 windows/amd64 windows/arm64; do for target in linux/amd64 linux/arm64; do
os="${target%/*}" os="${target%/*}"
arch="${target#*/}" arch="${target#*/}"
ext=""
if [[ "$os" == "windows" ]]; then
ext=".exe"
fi
bin="vociferate_${normalized_version}_${os}_${arch}${ext}" bin="vociferate_${normalized_version}_${os}_${arch}"
GOOS="$os" GOARCH="$arch" go build -trimpath -ldflags="-s -w" -o "dist/${bin}" ./cmd/releaseprep GOOS="$os" GOARCH="$arch" go build -trimpath -ldflags="-s -w" -o "dist/${bin}" ./cmd/vociferate
done done
( (

View File

@@ -37,7 +37,7 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
if recommended_tag="$(go run ./cmd/releaseprep --recommend --root . 2>release-recommendation.err)"; then if recommended_tag="$(go run ./cmd/vociferate --recommend --root . 2>release-recommendation.err)"; then
{ {
echo echo
echo '## Release Recommendation' echo '## Release Recommendation'

View File

@@ -13,7 +13,7 @@ just go-build
Or directly with Go: Or directly with Go:
```bash ```bash
go build -o dist/releaseprep ./cmd/releaseprep go build -o dist/vociferate ./cmd/vociferate
``` ```
## Usage ## Usage
@@ -21,13 +21,15 @@ go build -o dist/releaseprep ./cmd/releaseprep
Prepare release files: Prepare release files:
```bash ```bash
go run ./cmd/releaseprep --version v1.2.3 --date 2026-03-20 --root . go run ./cmd/vociferate --version v1.2.3 --date 2026-03-20 --root .
``` ```
In the provided workflow and composite action, `version` is optional. When it is omitted, vociferate computes and uses the recommended next version automatically.
Recommend next release tag from changelog content: Recommend next release tag from changelog content:
```bash ```bash
go run ./cmd/releaseprep --recommend --root . go run ./cmd/vociferate --recommend --root .
``` ```
### Flags ### Flags
@@ -42,10 +44,12 @@ go run ./cmd/releaseprep --recommend --root .
Defaults: Defaults:
- `version-file`: `internal/releaseprep/version/version.go` - `version-file`: `release-version`
- `version-pattern`: `const String = "([^"]+)"` - `version-pattern`: `^\s*([^\r\n]+)\s*$`
- `changelog`: `changelog.md` - `changelog`: `changelog.md`
By default, `vociferate` reads and writes the release version as the sole content of a root-level `release-version` file. Repositories that keep the version inside source code should pass explicit `version-file` and `version-pattern` values.
## Testing ## Testing
```bash ```bash
@@ -54,14 +58,10 @@ just go-test
## Release Artifacts ## Release Artifacts
The `Prepare Release` workflow creates a release and uploads prebuilt `vociferate` binaries for: Releases are prepared through the `Prepare Release` workflow. The workflow creates a release and uploads prebuilt `vociferate` binaries for:
- `darwin/amd64`
- `darwin/arm64`
- `linux/amd64` - `linux/amd64`
- `linux/arm64` - `linux/arm64`
- `windows/amd64`
- `windows/arm64`
It also uploads `checksums.txt` for integrity verification. It also uploads `checksums.txt` for integrity verification.
If a release already exists for the same tag, the workflow updates its release notes and replaces matching asset filenames so reruns stay in sync. If a release already exists for the same tag, the workflow updates its release notes and replaces matching asset filenames so reruns stay in sync.
@@ -74,14 +74,17 @@ Use the composite action directly:
```yaml ```yaml
- name: Prepare release files - name: Prepare release files
uses: git.hrafn.xyz/aether/vociferate@main uses: git.hrafn.xyz/aether/vociferate@v1.0.0
with: with:
version: v1.2.3
version-file: internal/myapp/version/version.go version-file: internal/myapp/version/version.go
version-pattern: 'const Version = "([^"]+)"' version-pattern: 'const Version = "([^"]+)"'
changelog: changelog.md changelog: changelog.md
``` ```
Set `version` only when you want to override the recommended version.
Pin the composite action to a released tag. It downloads a prebuilt Linux binary from vociferate releases and caches it on the runner, so it does not require installing Go.
If your repository uses the default plain-text `release-version` file, you can omit `version-file` and `version-pattern` entirely.
Call the reusable release workflow: Call the reusable release workflow:
```yaml ```yaml
@@ -91,8 +94,8 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
version: version:
description: Semantic version to release. description: Optional semantic version override.
required: true required: false
jobs: jobs:
release: release:

View File

@@ -1,9 +1,13 @@
name: releaseprep name: vociferate
description: Prepare release files or recommend a next semantic version tag. description: Prepare release files or recommend a next semantic version tag.
inputs: inputs:
token:
description: Optional token used to download the cached vociferate release binary. When omitted, the workflow token is used.
required: false
default: ''
version: version:
description: Semantic version to release. description: Optional semantic version override. When omitted, the recommended version is used.
required: false required: false
version-file: version-file:
description: Path to version file relative to repository root. description: Path to version file relative to repository root.
@@ -22,42 +26,125 @@ inputs:
required: false required: false
default: 'false' default: 'false'
outputs:
version:
description: Resolved version used for prepare mode, or the emitted recommended version for recommend mode.
value: ${{ steps.run-vociferate.outputs.version }}
runs: runs:
using: composite using: composite
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-go@v5 - name: Resolve vociferate binary metadata
with: id: resolve-binary
go-version: '1.26.1'
- name: Run releaseprep
shell: bash shell: bash
env:
ACTION_REF: ${{ github.action_ref }}
SERVER_URL: ${{ github.server_url }}
API_URL: ${{ github.api_url }}
TOKEN: ${{ inputs.token != '' && inputs.token || github.token }}
RUNNER_ARCH: ${{ runner.arch }}
RUNNER_TEMP: ${{ runner.temp }}
run: | run: |
set -euo pipefail set -euo pipefail
args=(--root .) case "$RUNNER_ARCH" in
X64)
arch="amd64"
;;
ARM64)
arch="arm64"
;;
*)
echo "Unsupported runner architecture: $RUNNER_ARCH" >&2
exit 1
;;
esac
if [[ "${{ inputs.recommend }}" == "true" ]]; then release_tag="$ACTION_REF"
args+=(--recommend) if [[ -z "$release_tag" || "$release_tag" == refs/* || "$release_tag" != v* ]]; then
else release_tag="$(curl -fsSL \
if [[ -z "${{ inputs.version }}" ]]; then -H "Authorization: token ${TOKEN}" \
echo "input 'version' is required when recommend is false" >&2 -H "Content-Type: application/json" \
exit 2 "${API_URL}/repos/aether/vociferate/releases/latest" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n 1)"
fi fi
args+=(--version "${{ inputs.version }}" --date "$(date -u +%F)")
if [[ -z "$release_tag" ]]; then
echo "Unable to resolve a vociferate release tag for binary download" >&2
exit 1
fi fi
normalized_version="${release_tag#v}"
asset_name="vociferate_${normalized_version}_linux_${arch}"
cache_dir="${RUNNER_TEMP}/vociferate/${release_tag}/linux-${arch}"
binary_path="${cache_dir}/vociferate"
asset_url="${SERVER_URL}/aether/vociferate/releases/download/${release_tag}/${asset_name}"
mkdir -p "$cache_dir"
echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT"
echo "asset_name=$asset_name" >> "$GITHUB_OUTPUT"
echo "asset_url=$asset_url" >> "$GITHUB_OUTPUT"
echo "cache_dir=$cache_dir" >> "$GITHUB_OUTPUT"
echo "binary_path=$binary_path" >> "$GITHUB_OUTPUT"
- name: Restore cached vociferate binary
id: cache-vociferate
uses: actions/cache@v4
with:
path: ${{ steps.resolve-binary.outputs.cache_dir }}
key: vociferate-${{ steps.resolve-binary.outputs.release_tag }}-linux-${{ runner.arch }}
- name: Download vociferate binary
if: steps.cache-vociferate.outputs.cache-hit != 'true'
shell: bash
env:
TOKEN: ${{ inputs.token != '' && inputs.token || github.token }}
ASSET_URL: ${{ steps.resolve-binary.outputs.asset_url }}
BINARY_PATH: ${{ steps.resolve-binary.outputs.binary_path }}
run: |
set -euo pipefail
curl --fail --location \
-H "Authorization: token ${TOKEN}" \
-o "$BINARY_PATH" \
"$ASSET_URL"
chmod +x "$BINARY_PATH"
- name: Run vociferate
id: run-vociferate
shell: bash
env:
VOCIFERATE_BIN: ${{ steps.resolve-binary.outputs.binary_path }}
run: |
set -euo pipefail
common_args=(--root .)
if [[ -n "${{ inputs.version-file }}" ]]; then if [[ -n "${{ inputs.version-file }}" ]]; then
args+=(--version-file "${{ inputs.version-file }}") common_args+=(--version-file "${{ inputs.version-file }}")
fi fi
if [[ -n "${{ inputs.version-pattern }}" ]]; then if [[ -n "${{ inputs.version-pattern }}" ]]; then
args+=(--version-pattern "${{ inputs.version-pattern }}") common_args+=(--version-pattern "${{ inputs.version-pattern }}")
fi fi
if [[ -n "${{ inputs.changelog }}" ]]; then if [[ -n "${{ inputs.changelog }}" ]]; then
args+=(--changelog "${{ inputs.changelog }}") common_args+=(--changelog "${{ inputs.changelog }}")
fi fi
go run git.hrafn.xyz/aether/vociferate/cmd/releaseprep@latest "${args[@]}" if [[ "${{ inputs.recommend }}" == "true" ]]; then
resolved_version="$("$VOCIFERATE_BIN" "${common_args[@]}" --recommend)"
echo "$resolved_version"
echo "version=$resolved_version" >> "$GITHUB_OUTPUT"
exit 0
else
resolved_version="$(printf '%s' "${{ inputs.version }}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
if [[ -z "$resolved_version" ]]; then
resolved_version="$("$VOCIFERATE_BIN" "${common_args[@]}" --recommend)"
fi
fi
echo "version=$resolved_version" >> "$GITHUB_OUTPUT"
"$VOCIFERATE_BIN" "${common_args[@]}" --version "$resolved_version" --date "$(date -u +%F)"

View File

@@ -9,27 +9,26 @@ A `### Breaking` section is used in addition to Keep a Changelog's standard sect
## [Unreleased] ## [Unreleased]
## [1.0.0] - 2026-03-20
### Breaking ### Breaking
### Added - The default version source is now a root-level `release-version` file containing only the current release version. Repositories that store versions in code must now pass explicit `version-file` and `version-pattern` values.
### Changed
- The composite action now downloads and caches a released Linux `vociferate` binary instead of installing Go and running the module source directly.
- Added workflow coverage for the released Linux binaries consumed by the composite action on both `amd64` and `arm64`.
- Release preparation now runs directly in the release workflow; the repository-local helper script and just recipe were removed.
- Release artifacts are now limited to `linux/amd64` and `linux/arm64` binaries plus `checksums.txt`.
- The CLI entrypoint, internal package paths, build outputs, and automation references now use the `vociferate` name instead of the earlier `releaseprep` naming.
- The release workflow and composite action now treat a provided `version` as an override and otherwise fall back to the recommended next version automatically.
- Release creation is now idempotent: existing releases for the same tag are updated in place instead of recreated.
- Release asset uploads now replace existing assets with matching filenames so reruns stay synchronized.
- Release recommendation now forces a major version bump whenever a `### Breaking` heading is present in `## [Unreleased]`, even if the section has no bullet entries yet.
- Reusable `workflow_call` support for the `Prepare Release` workflow, enabling other repositories to invoke it directly. - Reusable `workflow_call` support for the `Prepare Release` workflow, enabling other repositories to invoke it directly.
- Automated release artifact publishing in the release workflow for `darwin`, `linux`, and `windows` binaries plus `checksums.txt`. - Automated release artifact publishing in the release workflow for `darwin`, `linux`, and `windows` binaries plus `checksums.txt`.
- README guidance for release artifacts and examples for reusing vociferate as a composite action or reusable workflow. - README guidance for release artifacts and examples for reusing vociferate as a composite action or reusable workflow.
- Initial standalone releaseprep migration into vociferate. - Initial standalone vociferate migration from its earlier internal naming.
- Configurable version source and parser via `--version-file` and `--version-pattern`. - Configurable version source and parser via `--version-file` and `--version-pattern`.
- Configurable changelog path via `--changelog`. - Configurable changelog path via `--changelog`.
- Composite action (`action.yml`) for release preparation and recommendation flows. - Composite action (`action.yml`) for release preparation and recommendation flows.
- Gitea workflows for push validation and manual release preparation. - Gitea workflows for push validation and manual release preparation.
### Changed
- Release creation is now idempotent: existing releases for the same tag are updated in place instead of recreated.
- Release asset uploads now replace existing assets with matching filenames so reruns stay synchronized.
- Release recommendation now forces a major version bump whenever a `### Breaking` heading is present in `## [Unreleased]`, even if the section has no bullet entries yet.
### Fixed
### Removed

View File

@@ -6,7 +6,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"git.hrafn.xyz/aether/vociferate/internal/releaseprep" "git.hrafn.xyz/aether/vociferate/internal/vociferate"
) )
func main() { func main() {
@@ -25,14 +25,14 @@ func main() {
os.Exit(1) os.Exit(1)
} }
opts := releaseprep.Options{ opts := vociferate.Options{
VersionFile: *versionFile, VersionFile: *versionFile,
VersionPattern: *versionPattern, VersionPattern: *versionPattern,
Changelog: *changelog, Changelog: *changelog,
} }
if *recommend { if *recommend {
tag, err := releaseprep.RecommendedTag(absRoot, opts) tag, err := vociferate.RecommendedTag(absRoot, opts)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "recommend release: %v\n", err) fmt.Fprintf(os.Stderr, "recommend release: %v\n", err)
os.Exit(1) os.Exit(1)
@@ -42,11 +42,11 @@ func main() {
} }
if *version == "" || *date == "" { if *version == "" || *date == "" {
fmt.Fprintln(os.Stderr, "usage: releaseprep --version <version> --date <YYYY-MM-DD> [--root <dir>] [--version-file <path>] [--version-pattern <regexp>] [--changelog <path>] | --recommend [--root <dir>] [--version-file <path>] [--version-pattern <regexp>] [--changelog <path>]") fmt.Fprintln(os.Stderr, "usage: vociferate --version <version> --date <YYYY-MM-DD> [--root <dir>] [--version-file <path>] [--version-pattern <regexp>] [--changelog <path>] | --recommend [--root <dir>] [--version-file <path>] [--version-pattern <regexp>] [--changelog <path>]")
os.Exit(2) os.Exit(2)
} }
if err := releaseprep.Prepare(absRoot, *version, *date, opts); err != nil { if err := vociferate.Prepare(absRoot, *version, *date, opts); err != nil {
fmt.Fprintf(os.Stderr, "prepare release: %v\n", err) fmt.Fprintf(os.Stderr, "prepare release: %v\n", err)
os.Exit(1) os.Exit(1)
} }

View File

@@ -1,3 +0,0 @@
package version
const String = "1.0.0"

View File

@@ -1,4 +1,4 @@
package releaseprep package vociferate
import ( import (
"fmt" "fmt"
@@ -10,8 +10,8 @@ import (
) )
const ( const (
defaultVersionFile = "internal/releaseprep/version/version.go" defaultVersionFile = "release-version"
defaultVersionExpr = `const String = "([^"]+)"` defaultVersionExpr = `^\s*([^\r\n]+)\s*$`
defaultChangelog = "changelog.md" defaultChangelog = "changelog.md"
) )

View File

@@ -1,11 +1,11 @@
package releaseprep_test package vociferate_test
import ( import (
"os" "os"
"path/filepath" "path/filepath"
"testing" "testing"
"git.hrafn.xyz/aether/vociferate/internal/releaseprep" "git.hrafn.xyz/aether/vociferate/internal/vociferate"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
) )
@@ -21,12 +21,9 @@ func TestPrepareSuite(t *testing.T) {
func (s *PrepareSuite) SetupTest() { func (s *PrepareSuite) SetupTest() {
s.rootDir = s.T().TempDir() s.rootDir = s.T().TempDir()
versionDir := filepath.Join(s.rootDir, "internal", "releaseprep", "version")
require.NoError(s.T(), os.MkdirAll(versionDir, 0o755))
require.NoError(s.T(), os.WriteFile( require.NoError(s.T(), os.WriteFile(
filepath.Join(versionDir, "version.go"), filepath.Join(s.rootDir, "release-version"),
[]byte("package version\n\nconst String = \"1.1.6\"\n"), []byte("1.1.6\n"),
0o644, 0o644,
)) ))
@@ -38,13 +35,13 @@ func (s *PrepareSuite) SetupTest() {
} }
func (s *PrepareSuite) TestPrepare_UpdatesVersionAndPromotesUnreleasedNotes() { func (s *PrepareSuite) TestPrepare_UpdatesVersionAndPromotesUnreleasedNotes() {
err := releaseprep.Prepare(s.rootDir, "v1.1.7", "2026-03-20", releaseprep.Options{}) err := vociferate.Prepare(s.rootDir, "v1.1.7", "2026-03-20", vociferate.Options{})
require.NoError(s.T(), err) require.NoError(s.T(), err)
versionBytes, err := os.ReadFile(filepath.Join(s.rootDir, "internal", "releaseprep", "version", "version.go")) versionBytes, err := os.ReadFile(filepath.Join(s.rootDir, "release-version"))
require.NoError(s.T(), err) require.NoError(s.T(), err)
require.Equal(s.T(), "package version\n\nconst String = \"1.1.7\"\n", string(versionBytes)) require.Equal(s.T(), "1.1.7\n", string(versionBytes))
changelogBytes, err := os.ReadFile(filepath.Join(s.rootDir, "changelog.md")) changelogBytes, err := os.ReadFile(filepath.Join(s.rootDir, "changelog.md"))
require.NoError(s.T(), err) require.NoError(s.T(), err)
@@ -58,7 +55,7 @@ func (s *PrepareSuite) TestPrepare_ReturnsErrorWhenUnreleasedSectionMissing() {
0o644, 0o644,
)) ))
err := releaseprep.Prepare(s.rootDir, "1.1.7", "2026-03-20", releaseprep.Options{}) err := vociferate.Prepare(s.rootDir, "1.1.7", "2026-03-20", vociferate.Options{})
require.ErrorContains(s.T(), err, "unreleased section") require.ErrorContains(s.T(), err, "unreleased section")
} }
@@ -70,13 +67,13 @@ func (s *PrepareSuite) TestPrepare_ReturnsErrorWhenUnreleasedSectionIsEmpty() {
0o644, 0o644,
)) ))
err := releaseprep.Prepare(s.rootDir, "1.1.7", "2026-03-20", releaseprep.Options{}) err := vociferate.Prepare(s.rootDir, "1.1.7", "2026-03-20", vociferate.Options{})
require.ErrorContains(s.T(), err, "unreleased section is empty") require.ErrorContains(s.T(), err, "unreleased section is empty")
} }
func (s *PrepareSuite) TestRecommendedTag_UsesMajorBumpWhenBreakingHeadingExists() { func (s *PrepareSuite) TestRecommendedTag_UsesMajorBumpWhenBreakingHeadingExists() {
tag, err := releaseprep.RecommendedTag(s.rootDir, releaseprep.Options{}) tag, err := vociferate.RecommendedTag(s.rootDir, vociferate.Options{})
require.NoError(s.T(), err) require.NoError(s.T(), err)
require.Equal(s.T(), "v2.0.0", tag) require.Equal(s.T(), "v2.0.0", tag)
@@ -89,7 +86,7 @@ func (s *PrepareSuite) TestRecommendedTag_UsesPatchBumpForFixOnlyChanges() {
0o644, 0o644,
)) ))
tag, err := releaseprep.RecommendedTag(s.rootDir, releaseprep.Options{}) tag, err := vociferate.RecommendedTag(s.rootDir, vociferate.Options{})
require.NoError(s.T(), err) require.NoError(s.T(), err)
require.Equal(s.T(), "v1.1.7", tag) require.Equal(s.T(), "v1.1.7", tag)
@@ -102,7 +99,7 @@ func (s *PrepareSuite) TestRecommendedTag_UsesMajorBumpWhenRemovedEntriesExist()
0o644, 0o644,
)) ))
tag, err := releaseprep.RecommendedTag(s.rootDir, releaseprep.Options{}) tag, err := vociferate.RecommendedTag(s.rootDir, vociferate.Options{})
require.NoError(s.T(), err) require.NoError(s.T(), err)
require.Equal(s.T(), "v2.0.0", tag) require.Equal(s.T(), "v2.0.0", tag)
@@ -115,7 +112,7 @@ func (s *PrepareSuite) TestRecommendedTag_UsesMajorBumpWhenBreakingEntriesExist(
0o644, 0o644,
)) ))
tag, err := releaseprep.RecommendedTag(s.rootDir, releaseprep.Options{}) tag, err := vociferate.RecommendedTag(s.rootDir, vociferate.Options{})
require.NoError(s.T(), err) require.NoError(s.T(), err)
require.Equal(s.T(), "v2.0.0", tag) require.Equal(s.T(), "v2.0.0", tag)
@@ -130,7 +127,7 @@ func (s *PrepareSuite) TestPrepare_UsesCustomVersionFileAndPattern() {
0o644, 0o644,
)) ))
err := releaseprep.Prepare(s.rootDir, "1.1.8", "2026-03-20", releaseprep.Options{ err := vociferate.Prepare(s.rootDir, "1.1.8", "2026-03-20", vociferate.Options{
VersionFile: customVersionFile, VersionFile: customVersionFile,
VersionPattern: `VERSION=([^\n]+)`, VersionPattern: `VERSION=([^\n]+)`,
}) })
@@ -144,18 +141,18 @@ func (s *PrepareSuite) TestPrepare_UsesCustomVersionFileAndPattern() {
func (s *PrepareSuite) TestPrepare_AllowsUnchangedVersionValue() { func (s *PrepareSuite) TestPrepare_AllowsUnchangedVersionValue() {
require.NoError(s.T(), os.WriteFile( require.NoError(s.T(), os.WriteFile(
filepath.Join(s.rootDir, "internal", "releaseprep", "version", "version.go"), filepath.Join(s.rootDir, "release-version"),
[]byte("package version\n\nconst String = \"1.1.6\"\n"), []byte("1.1.6\n"),
0o644, 0o644,
)) ))
err := releaseprep.Prepare(s.rootDir, "1.1.6", "2026-03-20", releaseprep.Options{}) err := vociferate.Prepare(s.rootDir, "1.1.6", "2026-03-20", vociferate.Options{})
require.NoError(s.T(), err) require.NoError(s.T(), err)
versionBytes, readErr := os.ReadFile(filepath.Join(s.rootDir, "internal", "releaseprep", "version", "version.go")) versionBytes, readErr := os.ReadFile(filepath.Join(s.rootDir, "release-version"))
require.NoError(s.T(), readErr) require.NoError(s.T(), readErr)
require.Equal(s.T(), "package version\n\nconst String = \"1.1.6\"\n", string(versionBytes)) require.Equal(s.T(), "1.1.6\n", string(versionBytes))
} }
func (s *PrepareSuite) TestRecommendedTag_UsesCustomVersionFileAndPattern() { func (s *PrepareSuite) TestRecommendedTag_UsesCustomVersionFileAndPattern() {
@@ -172,7 +169,7 @@ func (s *PrepareSuite) TestRecommendedTag_UsesCustomVersionFileAndPattern() {
0o644, 0o644,
)) ))
tag, err := releaseprep.RecommendedTag(s.rootDir, releaseprep.Options{ tag, err := vociferate.RecommendedTag(s.rootDir, vociferate.Options{
VersionFile: customVersionFile, VersionFile: customVersionFile,
VersionPattern: `VERSION=([^\n]+)`, VersionPattern: `VERSION=([^\n]+)`,
}) })

View File

@@ -5,10 +5,7 @@ default:
go-build: go-build:
@mkdir -p dist @mkdir -p dist
go build -o dist/releaseprep ./cmd/releaseprep go build -o dist/vociferate ./cmd/vociferate
go-test: go-test:
go test ./... go test ./...
prepare-release version:
./script/prepare-release.sh "{{version}}"

1
release-version Normal file
View File

@@ -0,0 +1 @@
1.0.0

View File

@@ -1,18 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -ne 1 ]]; then
echo "usage: $0 <version>" >&2
exit 2
fi
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
release_date="$(date -u +%F)"
go run ./cmd/releaseprep \
--root "$repo_root" \
--version "$1" \
--date "$release_date" \
--version-file internal/releaseprep/version/version.go \
--version-pattern 'const String = "([^"]+)"' \
--changelog changelog.md