chore(go): centralize action runtime selection

This commit is contained in:
Micheal Wilkinson
2026-03-21 14:34:00 +00:00
parent 92f76fd19f
commit 3eb814a3d5
3 changed files with 306 additions and 138 deletions

View File

@@ -147,15 +147,70 @@ runs:
-H "Content-Type: application/json" \
"$comments_url" >/dev/null
- name: Setup Go for vociferate
- 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: Setup Go
if: steps.resolve-binary.outputs.use_binary != 'true'
uses: actions/setup-go@v5
with:
go-version-file: ${{ github.action_path }}/../go.mod
go-version: '1.26.1'
cache: true
cache-dependency-path: ${{ steps.resolve-binary.outputs.source_root }}/go.sum
- name: Extract changelog unreleased entries
id: extract-changelog
- 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
working-directory: ${{ github.action_path }}/..
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 changelog unreleased entries from binary
id: extract-changelog-binary
if: steps.resolve-binary.outputs.use_binary == 'true'
shell: bash
env:
VOCIFERATE_BIN: ${{ steps.resolve-binary.outputs.binary_path }}
CHANGELOG: ${{ inputs.changelog }}
run: |
set -euo pipefail
if [[ ! -f "$CHANGELOG" ]]; then
printf 'unreleased_entries=%s\n' "" >> "$GITHUB_OUTPUT"
exit 0
fi
delimiter="EOF_CHANGELOG"
printf 'unreleased_entries<<%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
"$VOCIFERATE_BIN" --print-unreleased --root "$GITHUB_WORKSPACE" --changelog "$CHANGELOG" >> "$GITHUB_OUTPUT"
printf '%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
- name: Extract changelog unreleased entries from source
id: extract-changelog-source
if: steps.resolve-binary.outputs.use_binary != 'true'
shell: bash
working-directory: ${{ steps.resolve-binary.outputs.source_root }}
env:
CHANGELOG: ${{ inputs.changelog }}
run: |
@@ -171,6 +226,25 @@ runs:
go run ./cmd/vociferate --print-unreleased --root "$GITHUB_WORKSPACE" --changelog "$CHANGELOG" >> "$GITHUB_OUTPUT"
printf '%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
- name: Finalize changelog extraction
id: extract-changelog
shell: bash
env:
UNRELEASED_BINARY: ${{ steps.extract-changelog-binary.outputs.unreleased_entries }}
UNRELEASED_SOURCE: ${{ steps.extract-changelog-source.outputs.unreleased_entries }}
run: |
set -euo pipefail
unreleased="$UNRELEASED_BINARY"
if [[ -z "$unreleased" ]]; then
unreleased="$UNRELEASED_SOURCE"
fi
delimiter="EOF_CHANGELOG"
printf 'unreleased_entries<<%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
printf '%s\n' "$unreleased" >> "$GITHUB_OUTPUT"
printf '%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
- name: Validate changelog gate
id: changelog-gate
shell: bash