chore(go): compose vociferate runtime flow
This commit is contained in:
168
action.yml
168
action.yml
@@ -32,46 +32,13 @@ runs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Resolve vociferate binary metadata
|
- name: Resolve release date
|
||||||
id: resolve-binary
|
id: resolve-date
|
||||||
shell: bash
|
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: |
|
run: |
|
||||||
bash "$GITHUB_ACTION_PATH/script/resolve-vociferate-runtime.sh"
|
set -euo pipefail
|
||||||
|
|
||||||
- name: Setup Go
|
printf 'value=%s\n' "$(date -u +%F)" >> "$GITHUB_OUTPUT"
|
||||||
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
|
- name: Normalize version input
|
||||||
id: normalize-version
|
id: normalize-version
|
||||||
@@ -84,74 +51,30 @@ runs:
|
|||||||
resolved_version="$(printf '%s' "${INPUT_VERSION:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
resolved_version="$(printf '%s' "${INPUT_VERSION:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||||
printf 'value=%s\n' "$resolved_version" >> "$GITHUB_OUTPUT"
|
printf 'value=%s\n' "$resolved_version" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Recommend version from binary
|
- name: Recommend version
|
||||||
id: recommend-binary
|
id: recommend-version
|
||||||
if: (inputs.recommend == 'true' || steps.normalize-version.outputs.value == '') && steps.resolve-binary.outputs.use_binary == 'true'
|
if: inputs.recommend == 'true' || steps.normalize-version.outputs.value == ''
|
||||||
shell: bash
|
uses: ./run-vociferate
|
||||||
env:
|
with:
|
||||||
VOCIFERATE_BIN: ${{ steps.resolve-binary.outputs.binary_path }}
|
root: ${{ github.workspace }}
|
||||||
run: |
|
version-file: ${{ inputs.version-file }}
|
||||||
set -euo pipefail
|
version-pattern: ${{ inputs.version-pattern }}
|
||||||
|
changelog: ${{ inputs.changelog }}
|
||||||
common_args=(--root "$GITHUB_WORKSPACE")
|
recommend: 'true'
|
||||||
|
|
||||||
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: Finalize version
|
- name: Finalize version
|
||||||
id: finalize-version
|
id: finalize-version
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
PROVIDED_VERSION: ${{ steps.normalize-version.outputs.value }}
|
PROVIDED_VERSION: ${{ steps.normalize-version.outputs.value }}
|
||||||
RECOMMENDED_BINARY: ${{ steps.recommend-binary.outputs.version }}
|
RECOMMENDED_VERSION: ${{ steps.recommend-version.outputs.stdout }}
|
||||||
RECOMMENDED_SOURCE: ${{ steps.recommend-source.outputs.version }}
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if [[ -n "$PROVIDED_VERSION" ]] && [[ "${{ inputs.recommend }}" != 'true' ]]; then
|
if [[ -n "$PROVIDED_VERSION" ]] && [[ "${{ inputs.recommend }}" != 'true' ]]; then
|
||||||
resolved_version="$PROVIDED_VERSION"
|
resolved_version="$PROVIDED_VERSION"
|
||||||
else
|
else
|
||||||
resolved_version="$RECOMMENDED_BINARY"
|
resolved_version="$RECOMMENDED_VERSION"
|
||||||
if [[ -z "$resolved_version" ]]; then
|
|
||||||
resolved_version="$RECOMMENDED_SOURCE"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${{ inputs.recommend }}" == 'true' ]]; then
|
if [[ "${{ inputs.recommend }}" == 'true' ]]; then
|
||||||
@@ -160,52 +83,13 @@ runs:
|
|||||||
|
|
||||||
printf 'version=%s\n' "$resolved_version" >> "$GITHUB_OUTPUT"
|
printf 'version=%s\n' "$resolved_version" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Prepare release files with binary
|
- name: Prepare release files
|
||||||
if: inputs.recommend != 'true' && steps.resolve-binary.outputs.use_binary == 'true'
|
if: inputs.recommend != 'true'
|
||||||
shell: bash
|
uses: ./run-vociferate
|
||||||
env:
|
with:
|
||||||
VOCIFERATE_BIN: ${{ steps.resolve-binary.outputs.binary_path }}
|
root: ${{ github.workspace }}
|
||||||
VOCIFERATE_REPOSITORY_URL: ${{ vars.VOCIFERATE_REPOSITORY_URL }}
|
version-file: ${{ inputs.version-file }}
|
||||||
run: |
|
version-pattern: ${{ inputs.version-pattern }}
|
||||||
set -euo pipefail
|
changelog: ${{ inputs.changelog }}
|
||||||
|
version: ${{ steps.finalize-version.outputs.version }}
|
||||||
common_args=(--root "$GITHUB_WORKSPACE")
|
date: ${{ steps.resolve-date.outputs.value }}
|
||||||
|
|
||||||
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)"
|
|
||||||
|
|||||||
@@ -147,103 +147,28 @@ runs:
|
|||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
"$comments_url" >/dev/null
|
"$comments_url" >/dev/null
|
||||||
|
|
||||||
- name: Resolve vociferate binary metadata
|
- name: Detect changelog file
|
||||||
id: resolve-binary
|
id: changelog-file
|
||||||
shell: bash
|
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:
|
env:
|
||||||
CHANGELOG: ${{ inputs.changelog }}
|
CHANGELOG: ${{ inputs.changelog }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if [[ ! -f "$CHANGELOG" ]]; then
|
if [[ ! -f "$CHANGELOG" ]]; then
|
||||||
printf 'unreleased_entries=%s\n' "" >> "$GITHUB_OUTPUT"
|
printf 'exists=false\n' >> "$GITHUB_OUTPUT"
|
||||||
exit 0
|
else
|
||||||
|
printf 'exists=true\n' >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
delimiter="EOF_CHANGELOG"
|
- name: Extract changelog unreleased entries
|
||||||
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
|
|
||||||
id: extract-changelog
|
id: extract-changelog
|
||||||
shell: bash
|
if: steps.changelog-file.outputs.exists == 'true'
|
||||||
env:
|
uses: ../run-vociferate
|
||||||
UNRELEASED_BINARY: ${{ steps.extract-changelog-binary.outputs.unreleased_entries }}
|
with:
|
||||||
UNRELEASED_SOURCE: ${{ steps.extract-changelog-source.outputs.unreleased_entries }}
|
root: ${{ github.workspace }}
|
||||||
run: |
|
changelog: ${{ inputs.changelog }}
|
||||||
set -euo pipefail
|
print-unreleased: 'true'
|
||||||
|
|
||||||
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
|
- name: Validate changelog gate
|
||||||
id: changelog-gate
|
id: changelog-gate
|
||||||
@@ -402,7 +327,7 @@ runs:
|
|||||||
COMMENT_TITLE: ${{ inputs.comment-title }}
|
COMMENT_TITLE: ${{ inputs.comment-title }}
|
||||||
COVERAGE_PCT: ${{ inputs.coverage-percentage }}
|
COVERAGE_PCT: ${{ inputs.coverage-percentage }}
|
||||||
BADGE_URL: ${{ inputs.badge-url }}
|
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_ENABLED: ${{ steps.changelog-gate.outputs.gate_enabled }}
|
||||||
GATE_PASSED: ${{ steps.changelog-gate.outputs.gate_passed }}
|
GATE_PASSED: ${{ steps.changelog-gate.outputs.gate_passed }}
|
||||||
GATE_MODE: ${{ inputs.changelog-gate-mode }}
|
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:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
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
|
- name: Normalize version input
|
||||||
id: normalize-version
|
id: normalize-version
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -104,73 +63,29 @@ runs:
|
|||||||
provided_version="$(printf '%s' "${INPUT_VERSION:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
provided_version="$(printf '%s' "${INPUT_VERSION:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||||
printf 'value=%s\n' "$provided_version" >> "$GITHUB_OUTPUT"
|
printf 'value=%s\n' "$provided_version" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Recommend version from binary
|
- name: Recommend version
|
||||||
id: recommend-binary
|
id: recommend-version
|
||||||
if: steps.normalize-version.outputs.value == '' && steps.resolve-binary.outputs.use_binary == 'true'
|
if: steps.normalize-version.outputs.value == ''
|
||||||
shell: bash
|
uses: ../run-vociferate
|
||||||
env:
|
with:
|
||||||
VOCIFERATE_BIN: ${{ steps.resolve-binary.outputs.binary_path }}
|
root: ${{ github.workspace }}
|
||||||
run: |
|
version-file: ${{ inputs.version-file }}
|
||||||
set -euo pipefail
|
version-pattern: ${{ inputs.version-pattern }}
|
||||||
|
changelog: ${{ inputs.changelog }}
|
||||||
common_args=(--root "$GITHUB_WORKSPACE")
|
recommend: 'true'
|
||||||
|
|
||||||
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: Finalize version
|
- name: Finalize version
|
||||||
id: finalize-version
|
id: finalize-version
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
PROVIDED_VERSION: ${{ steps.normalize-version.outputs.value }}
|
PROVIDED_VERSION: ${{ steps.normalize-version.outputs.value }}
|
||||||
RECOMMENDED_BINARY: ${{ steps.recommend-binary.outputs.version }}
|
RECOMMENDED_VERSION: ${{ steps.recommend-version.outputs.stdout }}
|
||||||
RECOMMENDED_SOURCE: ${{ steps.recommend-source.outputs.version }}
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
provided_version="$PROVIDED_VERSION"
|
provided_version="$PROVIDED_VERSION"
|
||||||
if [[ -z "$provided_version" ]]; then
|
if [[ -z "$provided_version" ]]; then
|
||||||
provided_version="$RECOMMENDED_BINARY"
|
provided_version="$RECOMMENDED_VERSION"
|
||||||
fi
|
|
||||||
if [[ -z "$provided_version" ]]; then
|
|
||||||
provided_version="$RECOMMENDED_SOURCE"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
normalized_version="${provided_version#v}"
|
normalized_version="${provided_version#v}"
|
||||||
@@ -178,55 +93,23 @@ runs:
|
|||||||
|
|
||||||
printf 'version=%s\n' "$tag" >> "$GITHUB_OUTPUT"
|
printf 'version=%s\n' "$tag" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Prepare release files with binary
|
- name: Resolve release date
|
||||||
if: steps.resolve-binary.outputs.use_binary == 'true'
|
id: resolve-date
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
|
||||||
VOCIFERATE_BIN: ${{ steps.resolve-binary.outputs.binary_path }}
|
|
||||||
VOCIFERATE_REPOSITORY_URL: ${{ vars.VOCIFERATE_REPOSITORY_URL }}
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
common_args=(--root "$GITHUB_WORKSPACE")
|
printf 'value=%s\n' "$(date -u +%F)" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
if [[ -n "${{ inputs.version-file }}" ]]; then
|
- name: Prepare release files
|
||||||
common_args+=(--version-file "${{ inputs.version-file }}")
|
uses: ../run-vociferate
|
||||||
fi
|
with:
|
||||||
|
root: ${{ github.workspace }}
|
||||||
if [[ -n "${{ inputs.version-pattern }}" ]]; then
|
version-file: ${{ inputs.version-file }}
|
||||||
common_args+=(--version-pattern "${{ inputs.version-pattern }}")
|
version-pattern: ${{ inputs.version-pattern }}
|
||||||
fi
|
changelog: ${{ inputs.changelog }}
|
||||||
|
version: ${{ steps.finalize-version.outputs.version }}
|
||||||
if [[ -n "${{ inputs.changelog }}" ]]; then
|
date: ${{ steps.resolve-date.outputs.value }}
|
||||||
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: Commit and push release
|
- name: Commit and push release
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -36,19 +36,6 @@ outputs:
|
|||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
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
|
- name: Resolve release version
|
||||||
id: resolve-version
|
id: resolve-version
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -76,77 +63,26 @@ runs:
|
|||||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||||
echo "version=$normalized" >> "$GITHUB_OUTPUT"
|
echo "version=$normalized" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Extract release notes
|
||||||
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
|
|
||||||
id: extract-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
|
shell: bash
|
||||||
env:
|
env:
|
||||||
NOTES_FILE_BINARY: ${{ steps.extract-notes-binary.outputs.notes_file }}
|
RELEASE_NOTES: ${{ steps.extract-notes.outputs.stdout }}
|
||||||
NOTES_FILE_SOURCE: ${{ steps.extract-notes-source.outputs.notes_file }}
|
RUNNER_TEMP: ${{ runner.temp }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
notes_file="$NOTES_FILE_BINARY"
|
notes_file="${RUNNER_TEMP}/release-notes.md"
|
||||||
if [[ -z "$notes_file" ]]; then
|
printf '%s\n' "$RELEASE_NOTES" > "$notes_file"
|
||||||
notes_file="$NOTES_FILE_SOURCE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf 'notes_file=%s\n' "$notes_file" >> "$GITHUB_OUTPUT"
|
printf 'notes_file=%s\n' "$notes_file" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
@@ -156,7 +92,7 @@ runs:
|
|||||||
env:
|
env:
|
||||||
TOKEN: ${{ inputs.token != '' && inputs.token || github.token }}
|
TOKEN: ${{ inputs.token != '' && inputs.token || github.token }}
|
||||||
TAG_NAME: ${{ steps.resolve-version.outputs.tag }}
|
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_API_URL: ${{ github.api_url }}
|
||||||
GITHUB_SERVER_URL: ${{ github.server_url }}
|
GITHUB_SERVER_URL: ${{ github.server_url }}
|
||||||
GITHUB_SHA: ${{ github.sha }}
|
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