chore(go): compose vociferate runtime flow
This commit is contained in:
168
action.yml
168
action.yml
@@ -32,46 +32,13 @@ runs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Resolve vociferate binary metadata
|
||||
id: resolve-binary
|
||||
- name: Resolve release date
|
||||
id: resolve-date
|
||||
shell: bash
|
||||
env:
|
||||
ACTION_REF: ${{ github.action_ref }}
|
||||
ACTION_REPOSITORY: ${{ github.action_repository }}
|
||||
CACHE_TOKEN: ${{ env.VOCIFERATE_CACHE_TOKEN }}
|
||||
SERVER_URL: ${{ github.server_url }}
|
||||
API_URL: ${{ github.api_url }}
|
||||
TOKEN: ${{ github.token }}
|
||||
RUNNER_ARCH: ${{ runner.arch }}
|
||||
RUNNER_TEMP: ${{ runner.temp }}
|
||||
run: |
|
||||
bash "$GITHUB_ACTION_PATH/script/resolve-vociferate-runtime.sh"
|
||||
set -euo pipefail
|
||||
|
||||
- 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"
|
||||
printf 'value=%s\n' "$(date -u +%F)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Normalize version input
|
||||
id: normalize-version
|
||||
@@ -84,74 +51,30 @@ runs:
|
||||
resolved_version="$(printf '%s' "${INPUT_VERSION:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||
printf 'value=%s\n' "$resolved_version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Recommend version from binary
|
||||
id: recommend-binary
|
||||
if: (inputs.recommend == 'true' || steps.normalize-version.outputs.value == '') && steps.resolve-binary.outputs.use_binary == 'true'
|
||||
shell: bash
|
||||
env:
|
||||
VOCIFERATE_BIN: ${{ steps.resolve-binary.outputs.binary_path }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
common_args=(--root "$GITHUB_WORKSPACE")
|
||||
|
||||
if [[ -n "${{ inputs.version-file }}" ]]; then
|
||||
common_args+=(--version-file "${{ inputs.version-file }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.version-pattern }}" ]]; then
|
||||
common_args+=(--version-pattern "${{ inputs.version-pattern }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.changelog }}" ]]; then
|
||||
common_args+=(--changelog "${{ inputs.changelog }}")
|
||||
fi
|
||||
|
||||
resolved_version="$($VOCIFERATE_BIN "${common_args[@]}" --recommend)"
|
||||
printf 'version=%s\n' "$resolved_version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Recommend version from source
|
||||
id: recommend-source
|
||||
if: (inputs.recommend == 'true' || steps.normalize-version.outputs.value == '') && steps.resolve-binary.outputs.use_binary != 'true'
|
||||
shell: bash
|
||||
working-directory: ${{ steps.resolve-binary.outputs.source_root }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
common_args=(--root "$GITHUB_WORKSPACE")
|
||||
|
||||
if [[ -n "${{ inputs.version-file }}" ]]; then
|
||||
common_args+=(--version-file "${{ inputs.version-file }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.version-pattern }}" ]]; then
|
||||
common_args+=(--version-pattern "${{ inputs.version-pattern }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.changelog }}" ]]; then
|
||||
common_args+=(--changelog "${{ inputs.changelog }}")
|
||||
fi
|
||||
|
||||
resolved_version="$(go run ./cmd/vociferate "${common_args[@]}" --recommend)"
|
||||
printf 'version=%s\n' "$resolved_version" >> "$GITHUB_OUTPUT"
|
||||
- name: Recommend version
|
||||
id: recommend-version
|
||||
if: inputs.recommend == 'true' || steps.normalize-version.outputs.value == ''
|
||||
uses: ./run-vociferate
|
||||
with:
|
||||
root: ${{ github.workspace }}
|
||||
version-file: ${{ inputs.version-file }}
|
||||
version-pattern: ${{ inputs.version-pattern }}
|
||||
changelog: ${{ inputs.changelog }}
|
||||
recommend: 'true'
|
||||
|
||||
- name: Finalize version
|
||||
id: finalize-version
|
||||
shell: bash
|
||||
env:
|
||||
PROVIDED_VERSION: ${{ steps.normalize-version.outputs.value }}
|
||||
RECOMMENDED_BINARY: ${{ steps.recommend-binary.outputs.version }}
|
||||
RECOMMENDED_SOURCE: ${{ steps.recommend-source.outputs.version }}
|
||||
RECOMMENDED_VERSION: ${{ steps.recommend-version.outputs.stdout }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -n "$PROVIDED_VERSION" ]] && [[ "${{ inputs.recommend }}" != 'true' ]]; then
|
||||
resolved_version="$PROVIDED_VERSION"
|
||||
else
|
||||
resolved_version="$RECOMMENDED_BINARY"
|
||||
if [[ -z "$resolved_version" ]]; then
|
||||
resolved_version="$RECOMMENDED_SOURCE"
|
||||
fi
|
||||
resolved_version="$RECOMMENDED_VERSION"
|
||||
fi
|
||||
|
||||
if [[ "${{ inputs.recommend }}" == 'true' ]]; then
|
||||
@@ -160,52 +83,13 @@ runs:
|
||||
|
||||
printf 'version=%s\n' "$resolved_version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Prepare release files with binary
|
||||
if: inputs.recommend != 'true' && steps.resolve-binary.outputs.use_binary == 'true'
|
||||
shell: bash
|
||||
env:
|
||||
VOCIFERATE_BIN: ${{ steps.resolve-binary.outputs.binary_path }}
|
||||
VOCIFERATE_REPOSITORY_URL: ${{ vars.VOCIFERATE_REPOSITORY_URL }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
common_args=(--root "$GITHUB_WORKSPACE")
|
||||
|
||||
if [[ -n "${{ inputs.version-file }}" ]]; then
|
||||
common_args+=(--version-file "${{ inputs.version-file }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.version-pattern }}" ]]; then
|
||||
common_args+=(--version-pattern "${{ inputs.version-pattern }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.changelog }}" ]]; then
|
||||
common_args+=(--changelog "${{ inputs.changelog }}")
|
||||
fi
|
||||
|
||||
"$VOCIFERATE_BIN" "${common_args[@]}" --version "${{ steps.finalize-version.outputs.version }}" --date "$(date -u +%F)"
|
||||
|
||||
- name: Prepare release files with source
|
||||
if: inputs.recommend != 'true' && steps.resolve-binary.outputs.use_binary != 'true'
|
||||
shell: bash
|
||||
working-directory: ${{ steps.resolve-binary.outputs.source_root }}
|
||||
env:
|
||||
VOCIFERATE_REPOSITORY_URL: ${{ vars.VOCIFERATE_REPOSITORY_URL }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
common_args=(--root "$GITHUB_WORKSPACE")
|
||||
|
||||
if [[ -n "${{ inputs.version-file }}" ]]; then
|
||||
common_args+=(--version-file "${{ inputs.version-file }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.version-pattern }}" ]]; then
|
||||
common_args+=(--version-pattern "${{ inputs.version-pattern }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.changelog }}" ]]; then
|
||||
common_args+=(--changelog "${{ inputs.changelog }}")
|
||||
fi
|
||||
|
||||
go run ./cmd/vociferate "${common_args[@]}" --version "${{ steps.finalize-version.outputs.version }}" --date "$(date -u +%F)"
|
||||
- name: Prepare release files
|
||||
if: inputs.recommend != 'true'
|
||||
uses: ./run-vociferate
|
||||
with:
|
||||
root: ${{ github.workspace }}
|
||||
version-file: ${{ inputs.version-file }}
|
||||
version-pattern: ${{ inputs.version-pattern }}
|
||||
changelog: ${{ inputs.changelog }}
|
||||
version: ${{ steps.finalize-version.outputs.version }}
|
||||
date: ${{ steps.resolve-date.outputs.value }}
|
||||
|
||||
@@ -147,103 +147,28 @@ runs:
|
||||
-H "Content-Type: application/json" \
|
||||
"$comments_url" >/dev/null
|
||||
|
||||
- name: Resolve vociferate binary metadata
|
||||
id: resolve-binary
|
||||
- name: Detect changelog file
|
||||
id: changelog-file
|
||||
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: '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 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: |
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ! -f "$CHANGELOG" ]]; then
|
||||
printf 'unreleased_entries=%s\n' "" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
printf 'exists=false\n' >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
printf 'exists=true\n' >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
delimiter="EOF_CHANGELOG"
|
||||
printf 'unreleased_entries<<%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
|
||||
go run ./cmd/vociferate --print-unreleased --root "$GITHUB_WORKSPACE" --changelog "$CHANGELOG" >> "$GITHUB_OUTPUT"
|
||||
printf '%s\n' "$delimiter" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Finalize changelog extraction
|
||||
- name: Extract changelog unreleased entries
|
||||
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"
|
||||
if: steps.changelog-file.outputs.exists == 'true'
|
||||
uses: ../run-vociferate
|
||||
with:
|
||||
root: ${{ github.workspace }}
|
||||
changelog: ${{ inputs.changelog }}
|
||||
print-unreleased: 'true'
|
||||
|
||||
- name: Validate changelog gate
|
||||
id: changelog-gate
|
||||
@@ -402,7 +327,7 @@ runs:
|
||||
COMMENT_TITLE: ${{ inputs.comment-title }}
|
||||
COVERAGE_PCT: ${{ inputs.coverage-percentage }}
|
||||
BADGE_URL: ${{ inputs.badge-url }}
|
||||
UNRELEASED: ${{ steps.extract-changelog.outputs.unreleased_entries }}
|
||||
UNRELEASED: ${{ steps.extract-changelog.outputs.stdout }}
|
||||
GATE_ENABLED: ${{ steps.changelog-gate.outputs.gate_enabled }}
|
||||
GATE_PASSED: ${{ steps.changelog-gate.outputs.gate_passed }}
|
||||
GATE_MODE: ${{ inputs.changelog-gate-mode }}
|
||||
|
||||
31
download-vociferate-binary/action.yml
Normal file
31
download-vociferate-binary/action.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
name: vociferate/download-vociferate-binary
|
||||
description: Download a released vociferate binary to a target path.
|
||||
|
||||
inputs:
|
||||
token:
|
||||
description: Token used to authenticate the download request.
|
||||
required: true
|
||||
asset-url:
|
||||
description: URL of the release asset to download.
|
||||
required: true
|
||||
binary-path:
|
||||
description: Destination path for the downloaded binary.
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Download binary
|
||||
shell: bash
|
||||
env:
|
||||
TOKEN: ${{ inputs.token }}
|
||||
ASSET_URL: ${{ inputs.asset-url }}
|
||||
BINARY_PATH: ${{ inputs.binary-path }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
curl --fail --location \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-o "$BINARY_PATH" \
|
||||
"$ASSET_URL"
|
||||
chmod +x "$BINARY_PATH"
|
||||
@@ -52,47 +52,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 }}
|
||||
API_URL: ${{ github.api_url }}
|
||||
TOKEN: ${{ github.token }}
|
||||
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: '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: Normalize version input
|
||||
id: normalize-version
|
||||
shell: bash
|
||||
@@ -104,73 +63,29 @@ runs:
|
||||
provided_version="$(printf '%s' "${INPUT_VERSION:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||
printf 'value=%s\n' "$provided_version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Recommend version from binary
|
||||
id: recommend-binary
|
||||
if: steps.normalize-version.outputs.value == '' && steps.resolve-binary.outputs.use_binary == 'true'
|
||||
shell: bash
|
||||
env:
|
||||
VOCIFERATE_BIN: ${{ steps.resolve-binary.outputs.binary_path }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
common_args=(--root "$GITHUB_WORKSPACE")
|
||||
|
||||
if [[ -n "${{ inputs.version-file }}" ]]; then
|
||||
common_args+=(--version-file "${{ inputs.version-file }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.version-pattern }}" ]]; then
|
||||
common_args+=(--version-pattern "${{ inputs.version-pattern }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.changelog }}" ]]; then
|
||||
common_args+=(--changelog "${{ inputs.changelog }}")
|
||||
fi
|
||||
|
||||
provided_version="$($VOCIFERATE_BIN "${common_args[@]}" --recommend)"
|
||||
printf 'version=%s\n' "$provided_version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Recommend version from source
|
||||
id: recommend-source
|
||||
if: steps.normalize-version.outputs.value == '' && steps.resolve-binary.outputs.use_binary != 'true'
|
||||
shell: bash
|
||||
working-directory: ${{ steps.resolve-binary.outputs.source_root }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
common_args=(--root "$GITHUB_WORKSPACE")
|
||||
|
||||
if [[ -n "${{ inputs.version-file }}" ]]; then
|
||||
common_args+=(--version-file "${{ inputs.version-file }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.version-pattern }}" ]]; then
|
||||
common_args+=(--version-pattern "${{ inputs.version-pattern }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.changelog }}" ]]; then
|
||||
common_args+=(--changelog "${{ inputs.changelog }}")
|
||||
fi
|
||||
|
||||
provided_version="$(go run ./cmd/vociferate "${common_args[@]}" --recommend)"
|
||||
printf 'version=%s\n' "$provided_version" >> "$GITHUB_OUTPUT"
|
||||
- name: Recommend version
|
||||
id: recommend-version
|
||||
if: steps.normalize-version.outputs.value == ''
|
||||
uses: ../run-vociferate
|
||||
with:
|
||||
root: ${{ github.workspace }}
|
||||
version-file: ${{ inputs.version-file }}
|
||||
version-pattern: ${{ inputs.version-pattern }}
|
||||
changelog: ${{ inputs.changelog }}
|
||||
recommend: 'true'
|
||||
|
||||
- name: Finalize version
|
||||
id: finalize-version
|
||||
shell: bash
|
||||
env:
|
||||
PROVIDED_VERSION: ${{ steps.normalize-version.outputs.value }}
|
||||
RECOMMENDED_BINARY: ${{ steps.recommend-binary.outputs.version }}
|
||||
RECOMMENDED_SOURCE: ${{ steps.recommend-source.outputs.version }}
|
||||
RECOMMENDED_VERSION: ${{ steps.recommend-version.outputs.stdout }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
provided_version="$PROVIDED_VERSION"
|
||||
if [[ -z "$provided_version" ]]; then
|
||||
provided_version="$RECOMMENDED_BINARY"
|
||||
fi
|
||||
if [[ -z "$provided_version" ]]; then
|
||||
provided_version="$RECOMMENDED_SOURCE"
|
||||
provided_version="$RECOMMENDED_VERSION"
|
||||
fi
|
||||
|
||||
normalized_version="${provided_version#v}"
|
||||
@@ -178,55 +93,23 @@ runs:
|
||||
|
||||
printf 'version=%s\n' "$tag" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Prepare release files with binary
|
||||
if: steps.resolve-binary.outputs.use_binary == 'true'
|
||||
- name: Resolve release date
|
||||
id: resolve-date
|
||||
shell: bash
|
||||
env:
|
||||
VOCIFERATE_BIN: ${{ steps.resolve-binary.outputs.binary_path }}
|
||||
VOCIFERATE_REPOSITORY_URL: ${{ vars.VOCIFERATE_REPOSITORY_URL }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
common_args=(--root "$GITHUB_WORKSPACE")
|
||||
printf 'value=%s\n' "$(date -u +%F)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
if [[ -n "${{ inputs.version-file }}" ]]; then
|
||||
common_args+=(--version-file "${{ inputs.version-file }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.version-pattern }}" ]]; then
|
||||
common_args+=(--version-pattern "${{ inputs.version-pattern }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.changelog }}" ]]; then
|
||||
common_args+=(--changelog "${{ inputs.changelog }}")
|
||||
fi
|
||||
|
||||
"$VOCIFERATE_BIN" "${common_args[@]}" --version "${{ steps.finalize-version.outputs.version }}" --date "$(date -u +%F)"
|
||||
|
||||
- name: Prepare release files with source
|
||||
if: steps.resolve-binary.outputs.use_binary != 'true'
|
||||
shell: bash
|
||||
working-directory: ${{ steps.resolve-binary.outputs.source_root }}
|
||||
env:
|
||||
VOCIFERATE_REPOSITORY_URL: ${{ vars.VOCIFERATE_REPOSITORY_URL }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
common_args=(--root "$GITHUB_WORKSPACE")
|
||||
|
||||
if [[ -n "${{ inputs.version-file }}" ]]; then
|
||||
common_args+=(--version-file "${{ inputs.version-file }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.version-pattern }}" ]]; then
|
||||
common_args+=(--version-pattern "${{ inputs.version-pattern }}")
|
||||
fi
|
||||
|
||||
if [[ -n "${{ inputs.changelog }}" ]]; then
|
||||
common_args+=(--changelog "${{ inputs.changelog }}")
|
||||
fi
|
||||
|
||||
go run ./cmd/vociferate "${common_args[@]}" --version "${{ steps.finalize-version.outputs.version }}" --date "$(date -u +%F)"
|
||||
- name: Prepare release files
|
||||
uses: ../run-vociferate
|
||||
with:
|
||||
root: ${{ github.workspace }}
|
||||
version-file: ${{ inputs.version-file }}
|
||||
version-pattern: ${{ inputs.version-pattern }}
|
||||
changelog: ${{ inputs.changelog }}
|
||||
version: ${{ steps.finalize-version.outputs.version }}
|
||||
date: ${{ steps.resolve-date.outputs.value }}
|
||||
|
||||
- name: Commit and push release
|
||||
shell: bash
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
91
resolve-vociferate-runtime/action.yml
Normal file
91
resolve-vociferate-runtime/action.yml
Normal file
@@ -0,0 +1,91 @@
|
||||
name: vociferate/resolve-vociferate-runtime
|
||||
description: Resolve whether vociferate should run from a released binary or source checkout.
|
||||
|
||||
outputs:
|
||||
use_binary:
|
||||
description: Whether a released binary should be used.
|
||||
value: ${{ steps.resolve.outputs.use_binary }}
|
||||
source_root:
|
||||
description: Action repository root that contains go.mod.
|
||||
value: ${{ steps.resolve.outputs.source_root }}
|
||||
release_tag:
|
||||
description: Action release tag when using a binary.
|
||||
value: ${{ steps.resolve.outputs.release_tag }}
|
||||
cache_token:
|
||||
description: Cache token used for the binary cache key.
|
||||
value: ${{ steps.resolve.outputs.cache_token }}
|
||||
asset_name:
|
||||
description: Binary asset name for the resolved platform.
|
||||
value: ${{ steps.resolve.outputs.asset_name }}
|
||||
asset_url:
|
||||
description: Download URL for the resolved binary asset.
|
||||
value: ${{ steps.resolve.outputs.asset_url }}
|
||||
cache_dir:
|
||||
description: Cache directory for the binary.
|
||||
value: ${{ steps.resolve.outputs.cache_dir }}
|
||||
binary_path:
|
||||
description: Expected path to the downloaded binary.
|
||||
value: ${{ steps.resolve.outputs.binary_path }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Resolve runtime
|
||||
id: resolve
|
||||
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: |
|
||||
set -euo pipefail
|
||||
|
||||
case "$RUNNER_ARCH" in
|
||||
X64)
|
||||
arch="amd64"
|
||||
;;
|
||||
ARM64)
|
||||
arch="arm64"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported runner architecture: $RUNNER_ARCH" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
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"
|
||||
|
||||
if [[ "$ACTION_REF" == v* ]]; then
|
||||
release_tag="$ACTION_REF"
|
||||
normalized_version="${release_tag#v}"
|
||||
asset_name="vociferate_${normalized_version}_linux_${arch}"
|
||||
cache_dir="${RUNNER_TEMP}/vociferate/${release_tag}/linux-${arch}"
|
||||
binary_path="${cache_dir}/vociferate"
|
||||
asset_url="${SERVER_URL}/aether/vociferate/releases/download/${release_tag}/${asset_name}"
|
||||
|
||||
provided_cache_token="$(printf '%s' "${CACHE_TOKEN:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||
if [[ -n "$provided_cache_token" ]]; then
|
||||
cache_token="$provided_cache_token"
|
||||
else
|
||||
cache_token="${ACTION_REPOSITORY:-aether/vociferate}-${release_tag}"
|
||||
fi
|
||||
|
||||
mkdir -p "$cache_dir"
|
||||
|
||||
printf 'use_binary=true\n' >> "$GITHUB_OUTPUT"
|
||||
printf 'release_tag=%s\n' "$release_tag" >> "$GITHUB_OUTPUT"
|
||||
printf 'cache_token=%s\n' "$cache_token" >> "$GITHUB_OUTPUT"
|
||||
printf 'asset_name=%s\n' "$asset_name" >> "$GITHUB_OUTPUT"
|
||||
printf 'asset_url=%s\n' "$asset_url" >> "$GITHUB_OUTPUT"
|
||||
printf 'cache_dir=%s\n' "$cache_dir" >> "$GITHUB_OUTPUT"
|
||||
printf 'binary_path=%s\n' "$binary_path" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
printf 'use_binary=false\n' >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
104
run-vociferate.binary/action.yml
Normal file
104
run-vociferate.binary/action.yml
Normal file
@@ -0,0 +1,104 @@
|
||||
name: vociferate/run-vociferate-binary
|
||||
description: Execute vociferate through a released binary.
|
||||
|
||||
inputs:
|
||||
binary-path:
|
||||
description: Path to the vociferate binary.
|
||||
required: true
|
||||
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: Run binary
|
||||
id: run
|
||||
shell: bash
|
||||
env:
|
||||
VOCIFERATE_BIN: ${{ inputs.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 }}
|
||||
VOCIFERATE_REPOSITORY_URL: ${{ vars.VOCIFERATE_REPOSITORY_URL }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
command=("$VOCIFERATE_BIN" --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"
|
||||
104
run-vociferate.code/action.yml
Normal file
104
run-vociferate.code/action.yml
Normal file
@@ -0,0 +1,104 @@
|
||||
name: vociferate/run-vociferate-code
|
||||
description: Execute vociferate from the checked-out Go source.
|
||||
|
||||
inputs:
|
||||
source-root:
|
||||
description: Action repository root containing the Go module.
|
||||
required: true
|
||||
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: Run source
|
||||
id: run
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.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"
|
||||
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"
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
curl --fail --location \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-o "$BINARY_PATH" \
|
||||
"$ASSET_URL"
|
||||
chmod +x "$BINARY_PATH"
|
||||
@@ -1,51 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
case "${RUNNER_ARCH}" in
|
||||
X64)
|
||||
arch="amd64"
|
||||
;;
|
||||
ARM64)
|
||||
arch="arm64"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported runner architecture: ${RUNNER_ARCH}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
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"
|
||||
|
||||
if [[ "${ACTION_REF:-}" == v* ]]; then
|
||||
release_tag="${ACTION_REF}"
|
||||
normalized_version="${release_tag#v}"
|
||||
asset_name="vociferate_${normalized_version}_linux_${arch}"
|
||||
cache_dir="${RUNNER_TEMP}/vociferate/${release_tag}/linux-${arch}"
|
||||
binary_path="${cache_dir}/vociferate"
|
||||
asset_url="${SERVER_URL}/aether/vociferate/releases/download/${release_tag}/${asset_name}"
|
||||
|
||||
provided_cache_token="$(printf '%s' "${CACHE_TOKEN:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||
if [[ -n "$provided_cache_token" ]]; then
|
||||
cache_token="$provided_cache_token"
|
||||
else
|
||||
cache_token="${ACTION_REPOSITORY:-aether/vociferate}-${release_tag}"
|
||||
fi
|
||||
|
||||
mkdir -p "$cache_dir"
|
||||
|
||||
printf 'use_binary=true\n' >> "$GITHUB_OUTPUT"
|
||||
printf 'release_tag=%s\n' "$release_tag" >> "$GITHUB_OUTPUT"
|
||||
printf 'cache_token=%s\n' "$cache_token" >> "$GITHUB_OUTPUT"
|
||||
printf 'asset_name=%s\n' "$asset_name" >> "$GITHUB_OUTPUT"
|
||||
printf 'asset_url=%s\n' "$asset_url" >> "$GITHUB_OUTPUT"
|
||||
printf 'cache_dir=%s\n' "$cache_dir" >> "$GITHUB_OUTPUT"
|
||||
printf 'binary_path=%s\n' "$binary_path" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
printf 'use_binary=false\n' >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
Reference in New Issue
Block a user