feat: add prepare and publish composite actions

Add two focused subdirectory composite actions:

- prepare/action.yml: downloads the vociferate binary, runs it to update
  changelog and release-version, then commits, tags, and pushes — replacing
  the boilerplate git steps consumers previously had to write inline.

- publish/action.yml: extracts the matching changelog section and creates or
  updates the Gitea/GitHub release. Outputs release-id, tag, and version so
  consumers can upload their own assets after it runs.

Simplify the vociferate workflows to use ./prepare and ./publish directly,
validating both actions in the self-release pipeline.

Update README to show the clean two-action usage pattern.
This commit is contained in:
Micheal Wilkinson
2026-03-20 20:27:22 +00:00
parent 4ae6f34931
commit 647d8cf76f
5 changed files with 429 additions and 256 deletions

112
README.md
View File

@@ -81,24 +81,10 @@ If a release already exists for the same tag, the workflow updates its release n
## Reuse In Other Repositories
You can reuse vociferate in two ways.
Vociferate ships two composite actions that together cover the full release flow.
Pin both to the same released tag.
Use the composite action directly in your prepare workflow:
```yaml
- name: Prepare release files
uses: git.hrafn.xyz/aether/vociferate@v1.0.0
with:
version-file: internal/myapp/version/version.go
version-pattern: 'const Version = "([^"]+)"'
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.
For repositories using changelog-based versioning (the default), omit `version-file` and `version-pattern` entirely. Only set them for repositories that embed the version inside source code.
A complete release setup should also split preparation from publication. For example:
### `prepare` — update files, commit, and push tag
```yaml
name: Prepare Release
@@ -118,26 +104,29 @@ jobs:
with:
fetch-depth: 0
- name: Prepare release files
id: prepare
uses: git.hrafn.xyz/aether/vociferate@v1.0.0
- uses: git.hrafn.xyz/aether/vociferate/prepare@v1.0.0
with:
version: ${{ inputs.version }}
- name: Commit and push prepared release
run: |
set -euo pipefail
tag="${{ steps.prepare.outputs.version }}"
git config user.name "gitea-actions[bot]"
git config user.email "gitea-actions[bot]@users.noreply.local"
git add changelog.md release-version
git commit -m "release: prepare ${tag}"
git tag "$tag"
git push origin HEAD
git push origin "$tag"
token: ${{ secrets.GITHUB_TOKEN }}
```
Then use a separate tag workflow to publish the release from the tagged revision:
Downloads a prebuilt vociferate binary, runs it to update `changelog.md` and
`release-version`, then commits those changes to the default branch and pushes
the release tag. Does not require Go on the runner.
For repositories that embed the version inside source code, pass `version-file`
and `version-pattern`:
```yaml
- uses: git.hrafn.xyz/aether/vociferate/prepare@v1.0.0
with:
version-file: internal/myapp/version/version.go
version-pattern: 'const Version = "([^"]+)"'
git-add-files: changelog.md internal/myapp/version/version.go
token: ${{ secrets.GITHUB_TOKEN }}
```
### `publish` — create release with changelog notes
```yaml
name: Do Release
@@ -149,42 +138,33 @@ on:
jobs:
release:
uses: aether/vociferate/.gitea/workflows/do-release.yml@main
secrets: inherit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: git.hrafn.xyz/aether/vociferate/publish@v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
```
Call the reusable prepare workflow:
Reads the matching section from `changelog.md` and creates or updates the
Gitea/GitHub release with those notes. The `version` input is optional — when
omitted it is derived from the current tag ref automatically.
The `publish` action outputs `release-id` so you can upload additional release
assets after it runs:
```yaml
name: Prepare Release
- id: publish
uses: git.hrafn.xyz/aether/vociferate/publish@v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
on:
workflow_dispatch:
inputs:
version:
description: Optional semantic version override.
required: false
jobs:
release:
uses: aether/vociferate/.gitea/workflows/prepare-release.yml@main
with:
version: ${{ inputs.version }}
secrets: inherit
```
And publish from tags with:
```yaml
name: Do Release
on:
push:
tags:
- "v*.*.*"
jobs:
release:
uses: aether/vociferate/.gitea/workflows/do-release.yml@main
secrets: inherit
- name: Upload my binary
run: |
curl --fail-with-body -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
"${{ github.api_url }}/repos/${{ github.repository }}/releases/${{ steps.publish.outputs.release-id }}/assets?name=myapp" \
--data-binary "@dist/myapp"
```