Files
grimmory/.github/actions/compute-release-notes/action.yml
T

140 lines
4.8 KiB
YAML

name: Compute Release Notes
description: Build conventional-commit release notes for an explicit git range.
inputs:
base_tag:
description: Stable tag that anchors the preview version calculation
required: false
default: ''
from_ref:
description: Git ref that marks the start of the changelog range
required: true
repository_url:
description: Repository URL used for compare and commit links
required: false
default: ''
to_ref:
description: Git ref that marks the end of the changelog range
required: true
outputs:
compare_url:
description: Compare URL for the computed range
value: ${{ steps.extract.outputs.compare_url }}
details_url:
description: Workflow run URL that contains the full markdown summary
value: ${{ steps.extract.outputs.details_url }}
predicted_version:
description: Predicted semantic version for the supplied range
value: ${{ steps.extract.outputs.predicted_version }}
release_notes:
description: Markdown notes generated from conventional commits
value: ${{ steps.extract.outputs.release_notes }}
release_type:
description: Highest semantic release type found in the range
value: ${{ steps.extract.outputs.release_type }}
released:
description: Whether the range contains any releasable commits
value: ${{ steps.extract.outputs.released }}
to_sha:
description: Resolved ending SHA for the range
value: ${{ steps.extract.outputs.to_sha }}
runs:
using: composite
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
ref: ${{ inputs.to_ref }}
- name: Install just
uses: taiki-e/install-action@a1df9120380005ebdc788c62449b841b205541dd # v2.71.0
with:
tool: just
- name: Set Up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: '24'
- name: Enable Corepack
shell: bash
run: |
corepack enable
corepack yarn --version
- name: Install Release Tooling Dependencies
shell: bash
run: just release install
- name: Generate Range Notes
shell: bash
env:
BASE_TAG: ${{ inputs.base_tag }}
FROM_REF: ${{ inputs.from_ref }}
OUTPUT_JSON: range-release.json
OUTPUT_NOTES: range-release-notes.md
REPOSITORY_URL: ${{ inputs.repository_url != '' && inputs.repository_url || format('{0}/{1}', github.server_url, github.repository) }}
TO_REF: ${{ inputs.to_ref }}
run: |
just release range-notes | tee tools/release/range-release.log
- name: Extract Range Outputs
id: extract
shell: bash
env:
BASE_TAG: ${{ inputs.base_tag }}
DETAILS_URL: ${{ format('{0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id) }}
FROM_REF: ${{ inputs.from_ref }}
TO_REF: ${{ inputs.to_ref }}
run: |
set -eu
compare_url="$(jq -r '.compareUrl // empty' tools/release/range-release.json)"
predicted_version="$(jq -r '.nextVersion // empty' tools/release/range-release.json)"
release_type="$(jq -r '.releaseType // empty' tools/release/range-release.json)"
released="$(jq -r '.released' tools/release/range-release.json)"
to_sha="$(jq -r '.toSha // empty' tools/release/range-release.json)"
release_notes_delim="EOF_$(openssl rand -hex 16)"
{
echo "compare_url=${compare_url}"
echo "details_url=${DETAILS_URL}"
echo "predicted_version=${predicted_version}"
echo "release_type=${release_type}"
echo "released=${released}"
echo "to_sha=${to_sha}"
echo "release_notes<<${release_notes_delim}"
cat tools/release/range-release-notes.md
printf '\n'
echo "${release_notes_delim}"
} >> "$GITHUB_OUTPUT"
{
echo "## Full Changelog"
echo
echo "- Range: \`${FROM_REF}..${TO_REF}\`"
echo "- Predicted version: \`${predicted_version:-none}\`"
echo "- Release type: \`${release_type:-none}\`"
if [ -n "${BASE_TAG}" ]; then
echo "- Base stable tag: \`${BASE_TAG}\`"
fi
if [ -n "$compare_url" ]; then
echo "- Compare: ${compare_url}"
fi
echo
cat tools/release/range-release-notes.md
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload Range Notes Artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: range-release-notes
path: |
tools/release/range-release.json
tools/release/range-release-notes.md
tools/release/range-release.log
retention-days: 14