chore(go): compose vociferate runtime flow

This commit is contained in:
Micheal Wilkinson
2026-03-21 14:45:50 +00:00
parent 9a91c70e5d
commit f04df719e2
11 changed files with 537 additions and 510 deletions

View File

@@ -36,19 +36,6 @@ outputs:
runs:
using: composite
steps:
- name: Resolve vociferate binary metadata
id: resolve-binary
shell: bash
env:
ACTION_REF: ${{ github.action_ref }}
ACTION_REPOSITORY: ${{ github.action_repository }}
CACHE_TOKEN: ${{ env.VOCIFERATE_CACHE_TOKEN }}
SERVER_URL: ${{ github.server_url }}
RUNNER_ARCH: ${{ runner.arch }}
RUNNER_TEMP: ${{ runner.temp }}
run: |
bash "$GITHUB_ACTION_PATH/../script/resolve-vociferate-runtime.sh"
- name: Resolve release version
id: resolve-version
shell: bash
@@ -76,77 +63,26 @@ runs:
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "version=$normalized" >> "$GITHUB_OUTPUT"
- name: Setup Go
if: steps.resolve-binary.outputs.use_binary != 'true'
uses: actions/setup-go@v5
with:
go-version: '1.26.1'
cache: true
cache-dependency-path: ${{ steps.resolve-binary.outputs.source_root }}/go.sum
- name: Restore cached vociferate binary
id: cache-vociferate
if: steps.resolve-binary.outputs.use_binary == 'true'
uses: actions/cache@v4
with:
path: ${{ steps.resolve-binary.outputs.cache_dir }}
key: vociferate-${{ steps.resolve-binary.outputs.cache_token }}-linux-${{ runner.arch }}
- name: Download vociferate binary
if: steps.resolve-binary.outputs.use_binary == 'true' && steps.cache-vociferate.outputs.cache-hit != 'true'
shell: bash
env:
TOKEN: ${{ github.token }}
ASSET_URL: ${{ steps.resolve-binary.outputs.asset_url }}
BINARY_PATH: ${{ steps.resolve-binary.outputs.binary_path }}
run: |
bash "${{ steps.resolve-binary.outputs.source_root }}/script/download-vociferate-binary.sh"
- name: Extract release notes from binary
id: extract-notes-binary
if: steps.resolve-binary.outputs.use_binary == 'true'
shell: bash
env:
VOCIFERATE_BIN: ${{ steps.resolve-binary.outputs.binary_path }}
CHANGELOG: ${{ inputs.changelog != '' && inputs.changelog || 'CHANGELOG.md' }}
RELEASE_VERSION: ${{ steps.resolve-version.outputs.version }}
RUNNER_TEMP: ${{ runner.temp }}
run: |
set -euo pipefail
notes_file="${RUNNER_TEMP}/release-notes.md"
"$VOCIFERATE_BIN" --print-release-notes --version "$RELEASE_VERSION" --root "$GITHUB_WORKSPACE" --changelog "$CHANGELOG" > "$notes_file"
printf 'notes_file=%s\n' "$notes_file" >> "$GITHUB_OUTPUT"
- name: Extract release notes from source
id: extract-notes-source
if: steps.resolve-binary.outputs.use_binary != 'true'
shell: bash
working-directory: ${{ steps.resolve-binary.outputs.source_root }}
env:
CHANGELOG: ${{ inputs.changelog != '' && inputs.changelog || 'CHANGELOG.md' }}
RELEASE_VERSION: ${{ steps.resolve-version.outputs.version }}
RUNNER_TEMP: ${{ runner.temp }}
run: |
set -euo pipefail
notes_file="${RUNNER_TEMP}/release-notes.md"
go run ./cmd/vociferate --print-release-notes --version "$RELEASE_VERSION" --root "$GITHUB_WORKSPACE" --changelog "$CHANGELOG" > "$notes_file"
printf 'notes_file=%s\n' "$notes_file" >> "$GITHUB_OUTPUT"
- name: Finalize release notes file
- name: Extract release notes
id: extract-notes
uses: ../run-vociferate
with:
root: ${{ github.workspace }}
changelog: ${{ inputs.changelog }}
version: ${{ steps.resolve-version.outputs.version }}
print-release-notes: 'true'
- name: Write release notes file
id: write-notes
shell: bash
env:
NOTES_FILE_BINARY: ${{ steps.extract-notes-binary.outputs.notes_file }}
NOTES_FILE_SOURCE: ${{ steps.extract-notes-source.outputs.notes_file }}
RELEASE_NOTES: ${{ steps.extract-notes.outputs.stdout }}
RUNNER_TEMP: ${{ runner.temp }}
run: |
set -euo pipefail
notes_file="$NOTES_FILE_BINARY"
if [[ -z "$notes_file" ]]; then
notes_file="$NOTES_FILE_SOURCE"
fi
notes_file="${RUNNER_TEMP}/release-notes.md"
printf '%s\n' "$RELEASE_NOTES" > "$notes_file"
printf 'notes_file=%s\n' "$notes_file" >> "$GITHUB_OUTPUT"
@@ -156,7 +92,7 @@ runs:
env:
TOKEN: ${{ inputs.token != '' && inputs.token || github.token }}
TAG_NAME: ${{ steps.resolve-version.outputs.tag }}
RELEASE_NOTES_FILE: ${{ steps.extract-notes.outputs.notes_file }}
RELEASE_NOTES_FILE: ${{ steps.write-notes.outputs.notes_file }}
GITHUB_API_URL: ${{ github.api_url }}
GITHUB_SERVER_URL: ${{ github.server_url }}
GITHUB_SHA: ${{ github.sha }}