chore(go): compose vociferate runtime flow
This commit is contained in:
129
run-vociferate/action.yml
Normal file
129
run-vociferate/action.yml
Normal file
@@ -0,0 +1,129 @@
|
||||
name: vociferate/run-vociferate
|
||||
description: Resolve the preferred runtime for vociferate and execute it with a consistent output contract.
|
||||
|
||||
inputs:
|
||||
root:
|
||||
description: Repository root to pass to vociferate.
|
||||
required: true
|
||||
version-file:
|
||||
description: Optional version file path.
|
||||
required: false
|
||||
default: ''
|
||||
version-pattern:
|
||||
description: Optional version pattern.
|
||||
required: false
|
||||
default: ''
|
||||
changelog:
|
||||
description: Optional changelog path.
|
||||
required: false
|
||||
default: ''
|
||||
version:
|
||||
description: Optional version argument.
|
||||
required: false
|
||||
default: ''
|
||||
date:
|
||||
description: Optional date argument.
|
||||
required: false
|
||||
default: ''
|
||||
recommend:
|
||||
description: Whether to run vociferate with --recommend.
|
||||
required: false
|
||||
default: 'false'
|
||||
print-unreleased:
|
||||
description: Whether to print the Unreleased body.
|
||||
required: false
|
||||
default: 'false'
|
||||
print-release-notes:
|
||||
description: Whether to print the release notes section for version.
|
||||
required: false
|
||||
default: 'false'
|
||||
|
||||
outputs:
|
||||
stdout:
|
||||
description: Captured stdout from the selected runtime.
|
||||
value: ${{ steps.finalize.outputs.stdout }}
|
||||
use_binary:
|
||||
description: Whether the selected runtime was the released binary.
|
||||
value: ${{ steps.resolve-runtime.outputs.use_binary }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Resolve runtime
|
||||
id: resolve-runtime
|
||||
uses: ../resolve-vociferate-runtime
|
||||
|
||||
- name: Setup Go
|
||||
if: steps.resolve-runtime.outputs.use_binary != 'true'
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.26.1'
|
||||
cache: true
|
||||
cache-dependency-path: ${{ steps.resolve-runtime.outputs.source_root }}/go.sum
|
||||
|
||||
- name: Restore cached binary
|
||||
id: cache-vociferate
|
||||
if: steps.resolve-runtime.outputs.use_binary == 'true'
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ steps.resolve-runtime.outputs.cache_dir }}
|
||||
key: vociferate-${{ steps.resolve-runtime.outputs.cache_token }}-linux-${{ runner.arch }}
|
||||
|
||||
- name: Download binary
|
||||
if: steps.resolve-runtime.outputs.use_binary == 'true' && steps.cache-vociferate.outputs.cache-hit != 'true'
|
||||
uses: ../download-vociferate-binary
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
asset-url: ${{ steps.resolve-runtime.outputs.asset_url }}
|
||||
binary-path: ${{ steps.resolve-runtime.outputs.binary_path }}
|
||||
|
||||
- name: Run binary
|
||||
id: run-binary
|
||||
if: steps.resolve-runtime.outputs.use_binary == 'true'
|
||||
uses: ../run-vociferate.binary
|
||||
with:
|
||||
binary-path: ${{ steps.resolve-runtime.outputs.binary_path }}
|
||||
root: ${{ inputs.root }}
|
||||
version-file: ${{ inputs.version-file }}
|
||||
version-pattern: ${{ inputs.version-pattern }}
|
||||
changelog: ${{ inputs.changelog }}
|
||||
version: ${{ inputs.version }}
|
||||
date: ${{ inputs.date }}
|
||||
recommend: ${{ inputs.recommend }}
|
||||
print-unreleased: ${{ inputs.print-unreleased }}
|
||||
print-release-notes: ${{ inputs.print-release-notes }}
|
||||
|
||||
- name: Run source
|
||||
id: run-code
|
||||
if: steps.resolve-runtime.outputs.use_binary != 'true'
|
||||
uses: ../run-vociferate.code
|
||||
with:
|
||||
source-root: ${{ steps.resolve-runtime.outputs.source_root }}
|
||||
root: ${{ inputs.root }}
|
||||
version-file: ${{ inputs.version-file }}
|
||||
version-pattern: ${{ inputs.version-pattern }}
|
||||
changelog: ${{ inputs.changelog }}
|
||||
version: ${{ inputs.version }}
|
||||
date: ${{ inputs.date }}
|
||||
recommend: ${{ inputs.recommend }}
|
||||
print-unreleased: ${{ inputs.print-unreleased }}
|
||||
print-release-notes: ${{ inputs.print-release-notes }}
|
||||
|
||||
- name: Finalize stdout
|
||||
id: finalize
|
||||
shell: bash
|
||||
env:
|
||||
STDOUT_BINARY: ${{ steps.run-binary.outputs.stdout }}
|
||||
STDOUT_CODE: ${{ steps.run-code.outputs.stdout }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
stdout="$STDOUT_BINARY"
|
||||
if [[ -z "$stdout" ]]; then
|
||||
stdout="$STDOUT_CODE"
|
||||
fi
|
||||
|
||||
delimiter="EOF_STDOUT"
|
||||
printf 'stdout<<%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
|
||||
printf '%s\n' "$stdout" >> "$GITHUB_OUTPUT"
|
||||
printf '%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
|
||||
Reference in New Issue
Block a user