96 lines
3.1 KiB
YAML
96 lines
3.1 KiB
YAML
name: vociferate
|
|
description: Prepare release files or recommend a next semantic version tag.
|
|
|
|
inputs:
|
|
version:
|
|
description: Optional semantic version override. When omitted, the recommended version is used.
|
|
required: false
|
|
version-file:
|
|
description: Path to version file relative to repository root. When omitted, the current version is derived from the most recent released section in the changelog.
|
|
required: false
|
|
default: ''
|
|
version-pattern:
|
|
description: Regular expression with one capture group for current version. Only required when version-file is set.
|
|
required: false
|
|
default: ''
|
|
changelog:
|
|
description: Path to changelog file relative to repository root.
|
|
required: false
|
|
default: CHANGELOG.md
|
|
recommend:
|
|
description: If true, print recommended next release tag.
|
|
required: false
|
|
default: 'false'
|
|
|
|
outputs:
|
|
version:
|
|
description: Resolved version used for prepare mode, or the emitted recommended version for recommend mode.
|
|
value: ${{ steps.finalize-version.outputs.version }}
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Resolve release date
|
|
id: resolve-date
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
printf 'value=%s\n' "$(date -u +%F)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Normalize version input
|
|
id: normalize-version
|
|
shell: bash
|
|
env:
|
|
INPUT_VERSION: ${{ inputs.version }}
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
resolved_version="$(printf '%s' "${INPUT_VERSION:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
|
printf 'value=%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_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_VERSION"
|
|
fi
|
|
|
|
if [[ "${{ inputs.recommend }}" == 'true' ]]; then
|
|
echo "$resolved_version"
|
|
fi
|
|
|
|
printf 'version=%s\n' "$resolved_version" >> "$GITHUB_OUTPUT"
|
|
|
|
- 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 }}
|