121 lines
3.5 KiB
YAML
121 lines
3.5 KiB
YAML
name: vociferate/run-vociferate-code
|
|
description: Execute vociferate from the checked-out Go source.
|
|
|
|
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 vociferate invocation.
|
|
value: ${{ steps.run.outputs.stdout }}
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Resolve source root
|
|
id: resolve-source
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
source_root="$GITHUB_ACTION_PATH"
|
|
if [[ ! -f "$source_root/go.mod" ]]; then
|
|
source_root="$(realpath "$GITHUB_ACTION_PATH/..")"
|
|
fi
|
|
|
|
printf 'source_root=%s\n' "$source_root" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.26.1'
|
|
cache: true
|
|
cache-dependency-path: ${{ steps.resolve-source.outputs.source_root }}/go.sum
|
|
|
|
- name: Run source
|
|
id: run
|
|
shell: bash
|
|
working-directory: ${{ steps.resolve-source.outputs.source_root }}
|
|
env:
|
|
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 }}
|
|
VOCIFERATE_REPOSITORY_URL: ${{ vars.VOCIFERATE_REPOSITORY_URL }}
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
command=(go run ./cmd/vociferate --root "$ROOT")
|
|
|
|
if [[ -n "$VERSION_FILE" ]]; then
|
|
command+=(--version-file "$VERSION_FILE")
|
|
fi
|
|
if [[ -n "$VERSION_PATTERN" ]]; then
|
|
command+=(--version-pattern "$VERSION_PATTERN")
|
|
fi
|
|
if [[ -n "$CHANGELOG" ]]; then
|
|
command+=(--changelog "$CHANGELOG")
|
|
fi
|
|
if [[ -n "$VERSION" ]]; then
|
|
command+=(--version "$VERSION")
|
|
fi
|
|
if [[ -n "$DATE" ]]; then
|
|
command+=(--date "$DATE")
|
|
fi
|
|
if [[ "$RECOMMEND" == 'true' ]]; then
|
|
command+=(--recommend)
|
|
fi
|
|
if [[ "$PRINT_UNRELEASED" == 'true' ]]; then
|
|
command+=(--print-unreleased)
|
|
fi
|
|
if [[ "$PRINT_RELEASE_NOTES" == 'true' ]]; then
|
|
command+=(--print-release-notes)
|
|
fi
|
|
|
|
stdout_file="$(mktemp)"
|
|
trap 'rm -f "$stdout_file"' EXIT
|
|
"${command[@]}" > "$stdout_file"
|
|
|
|
delimiter="EOF_STDOUT"
|
|
printf 'stdout<<%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
|
|
cat "$stdout_file" >> "$GITHUB_OUTPUT"
|
|
printf '%s\n' "$delimiter" >> "$GITHUB_OUTPUT" |