Compare commits
12 Commits
925c99bb9e
...
v1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f82dace4b2 | ||
|
|
81dced6ada | ||
|
|
62693935d0 | ||
|
|
c0b5ec385c | ||
|
|
84f6fbcfc8 | ||
|
|
4a2d234ba3 | ||
|
|
4841b04076 | ||
|
|
993768ae9b | ||
|
|
624b9d154c | ||
|
|
53a097784e | ||
|
|
511110f466 | ||
|
|
d5170b6874 |
@@ -28,7 +28,7 @@ jobs:
|
|||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
RELEASE_TOKEN: ${{ secrets.GITHUB_TOKEN || secrets.GITEA_TOKEN }}
|
RELEASE_TOKEN: ${{ secrets.RELEASE_PAT }}
|
||||||
SUMMARY_FILE: ${{ runner.temp }}/do-release-summary.md
|
SUMMARY_FILE: ${{ runner.temp }}/do-release-summary.md
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -125,7 +125,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.26.1'
|
go-version-file: go.mod
|
||||||
check-latest: false
|
check-latest: false
|
||||||
cache: true
|
cache: true
|
||||||
cache-dependency-path: go.sum
|
cache-dependency-path: go.sum
|
||||||
@@ -137,7 +137,7 @@ jobs:
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if [[ -z "${RELEASE_TOKEN:-}" ]]; then
|
if [[ -z "${RELEASE_TOKEN:-}" ]]; then
|
||||||
echo "No release token available. Set GITEA_TOKEN (or GITHUB_TOKEN on GitHub)." >&2
|
echo "No release token available. Set secrets.RELEASE_PAT." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ jobs:
|
|||||||
id: publish
|
id: publish
|
||||||
uses: ./publish
|
uses: ./publish
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN || secrets.GITEA_TOKEN }}
|
token: ${{ secrets.RELEASE_PAT }}
|
||||||
version: ${{ steps.resolve-version.outputs.version }}
|
version: ${{ steps.resolve-version.outputs.version }}
|
||||||
|
|
||||||
- name: Build release binaries
|
- name: Build release binaries
|
||||||
@@ -284,7 +284,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Download released binary
|
- name: Download released binary
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.GITHUB_TOKEN || secrets.GITEA_TOKEN }}
|
TOKEN: ${{ secrets.RELEASE_PAT }}
|
||||||
TAG_NAME: ${{ needs.release.outputs.tag }}
|
TAG_NAME: ${{ needs.release.outputs.tag }}
|
||||||
RELEASE_VERSION: ${{ needs.release.outputs.version }}
|
RELEASE_VERSION: ${{ needs.release.outputs.version }}
|
||||||
ASSET_ARCH: ${{ matrix.asset_arch }}
|
ASSET_ARCH: ${{ matrix.asset_arch }}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.26.1'
|
go-version-file: go.mod
|
||||||
check-latest: false
|
check-latest: false
|
||||||
cache: true
|
cache: true
|
||||||
cache-dependency-path: go.sum
|
cache-dependency-path: go.sum
|
||||||
@@ -124,17 +124,313 @@ jobs:
|
|||||||
VOCIFERATE_CACHE_TOKEN: ${{ steps.cache-token.outputs.value }}
|
VOCIFERATE_CACHE_TOKEN: ${{ steps.cache-token.outputs.value }}
|
||||||
with:
|
with:
|
||||||
version: ${{ steps.resolve-version.outputs.tag }}
|
version: ${{ steps.resolve-version.outputs.tag }}
|
||||||
|
token: ${{ secrets.RELEASE_PAT }}
|
||||||
git-add-files: CHANGELOG.md release-version README.md AGENTS.md
|
git-add-files: CHANGELOG.md release-version README.md AGENTS.md
|
||||||
|
|
||||||
- name: Summarize prepared release
|
- name: Summary
|
||||||
|
if: ${{ always() }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
tag="${{ steps.prepare.outputs.version }}"
|
tag="${{ steps.prepare.outputs.version }}"
|
||||||
{
|
{
|
||||||
echo "## Release Prepared"
|
echo "## Release Prepared"
|
||||||
echo
|
echo
|
||||||
echo "- Tag pushed: ${tag}"
|
echo "- Tag pushed: ${tag}"
|
||||||
echo "- Calling Do Release workflow for ${tag}."
|
} >> "$SUMMARY_FILE"
|
||||||
|
|
||||||
|
echo 'Summary'
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [[ -s "$SUMMARY_FILE" ]]; then
|
||||||
|
cat "$SUMMARY_FILE"
|
||||||
|
else
|
||||||
|
echo 'No summary generated.'
|
||||||
|
fi
|
||||||
|
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: docker.io/catthehacker/ubuntu:act-latest
|
||||||
|
needs: prepare
|
||||||
|
outputs:
|
||||||
|
tag: ${{ steps.publish.outputs.tag }}
|
||||||
|
version: ${{ steps.publish.outputs.version }}
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
RELEASE_TOKEN: ${{ secrets.RELEASE_PAT }}
|
||||||
|
SUMMARY_FILE: ${{ runner.temp }}/release-summary.md
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Resolve release version
|
||||||
|
id: resolve-version
|
||||||
|
env:
|
||||||
|
PREPARE_TAG: ${{ needs.prepare.outputs.tag }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
tag="$(printf '%s' "${PREPARE_TAG}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||||
|
|
||||||
|
# Unwrap Teacup expression strings if present.
|
||||||
|
if [[ "${tag}" =~ ^%\!t\(string=(.*)\)$ ]]; then
|
||||||
|
tag="${BASH_REMATCH[1]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
normalized="${tag#v}"
|
||||||
|
tag="v${normalized}"
|
||||||
|
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "version=${normalized}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Checkout release tag
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: refs/tags/${{ steps.resolve-version.outputs.tag }}
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
check-latest: false
|
||||||
|
cache: true
|
||||||
|
cache-dependency-path: go.sum
|
||||||
|
|
||||||
|
- name: Preflight release API access
|
||||||
|
env:
|
||||||
|
TAG_NAME: ${{ steps.resolve-version.outputs.tag }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ -z "${RELEASE_TOKEN:-}" ]]; then
|
||||||
|
echo "No release token available. Set secrets.RELEASE_PAT." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
api_base="${GITHUB_API_URL:-${GITHUB_SERVER_URL%/}/api/v1}"
|
||||||
|
repo_api="${api_base}/repos/${GITHUB_REPOSITORY}"
|
||||||
|
|
||||||
|
curl --fail-with-body -sS \
|
||||||
|
-H "Authorization: token ${RELEASE_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"${repo_api}" >/dev/null
|
||||||
|
|
||||||
|
curl --fail-with-body -sS \
|
||||||
|
-H "Authorization: token ${RELEASE_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"${repo_api}/releases?limit=1" >/dev/null
|
||||||
|
|
||||||
|
if ! git rev-parse --verify --quiet "refs/tags/${TAG_NAME}" >/dev/null; then
|
||||||
|
echo "Tag ${TAG_NAME} was not found in the checked out repository." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Create or update release
|
||||||
|
id: publish
|
||||||
|
uses: ./publish
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.RELEASE_PAT }}
|
||||||
|
version: ${{ steps.resolve-version.outputs.version }}
|
||||||
|
|
||||||
|
- name: Build release binaries
|
||||||
|
env:
|
||||||
|
RELEASE_VERSION: ${{ steps.publish.outputs.version }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
mkdir -p dist
|
||||||
|
|
||||||
|
for target in linux/amd64 linux/arm64; do
|
||||||
|
os="${target%/*}"
|
||||||
|
arch="${target#*/}"
|
||||||
|
|
||||||
|
bin="vociferate_${RELEASE_VERSION}_${os}_${arch}"
|
||||||
|
GOOS="$os" GOARCH="$arch" go build -trimpath -ldflags="-s -w" -o "dist/${bin}" ./cmd/vociferate
|
||||||
|
done
|
||||||
|
|
||||||
|
(
|
||||||
|
cd dist
|
||||||
|
shasum -a 256 * > checksums.txt
|
||||||
|
)
|
||||||
|
|
||||||
|
- name: Upload release binaries
|
||||||
|
env:
|
||||||
|
RELEASE_ID: ${{ steps.publish.outputs.release-id }}
|
||||||
|
RELEASE_VERSION: ${{ steps.publish.outputs.version }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
raw_release_id="$(printf '%s' "${RELEASE_ID:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||||
|
if [[ "$raw_release_id" =~ ^%\!t\(string=(.*)\)$ ]]; then
|
||||||
|
raw_release_id="${BASH_REMATCH[1]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
release_id="$(printf '%s' "$raw_release_id" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||||
|
if ! [[ "$release_id" =~ ^[0-9]+$ ]]; then
|
||||||
|
echo "Invalid release id from publish step: '${RELEASE_ID}'" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
release_detail_api="${GITHUB_API_URL:-${GITHUB_SERVER_URL%/}/api/v1}/repos/${GITHUB_REPOSITORY}/releases/${release_id}"
|
||||||
|
if ! curl --fail-with-body -sS \
|
||||||
|
-H "Authorization: token ${RELEASE_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"$release_detail_api" >/dev/null; then
|
||||||
|
echo "Resolved release endpoint is not accessible: ${release_detail_api}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
release_api="${GITHUB_API_URL:-${GITHUB_SERVER_URL%/}/api/v1}/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets"
|
||||||
|
|
||||||
|
for asset in dist/*; do
|
||||||
|
name="$(basename "$asset")"
|
||||||
|
|
||||||
|
assets_json="$(curl -sS --fail-with-body \
|
||||||
|
-H "Authorization: token ${RELEASE_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"${release_api}")"
|
||||||
|
|
||||||
|
escaped_name="$(printf '%s' "$name" | sed 's/[][(){}.^$*+?|\\/]/\\&/g')"
|
||||||
|
existing_asset_id="$(printf '%s' "$assets_json" | tr -d '\n' | sed -n "s/.*{\"id\":\([0-9][0-9]*\)[^}]*\"name\":\"${escaped_name}\".*/\1/p")"
|
||||||
|
|
||||||
|
if [[ -n "$existing_asset_id" ]]; then
|
||||||
|
curl --fail-with-body \
|
||||||
|
-X DELETE \
|
||||||
|
-H "Authorization: token ${RELEASE_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"${release_api}/${existing_asset_id}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl --fail-with-body \
|
||||||
|
-X POST \
|
||||||
|
-H "Authorization: token ${RELEASE_TOKEN}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
"${release_api}?name=${name}" \
|
||||||
|
--data-binary "@${asset}"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Summary
|
||||||
|
if: ${{ always() }}
|
||||||
|
env:
|
||||||
|
TAG_NAME: ${{ steps.publish.outputs.tag }}
|
||||||
|
RELEASE_VERSION: ${{ steps.publish.outputs.version }}
|
||||||
|
PUBLISH_OUTCOME: ${{ steps.publish.outcome }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ "${PUBLISH_OUTCOME}" == "success" ]]; then
|
||||||
|
{
|
||||||
|
echo "## Release Published"
|
||||||
|
echo
|
||||||
|
echo "- Tag: ${TAG_NAME}"
|
||||||
|
echo "- Release notes sourced from changelog entry ${RELEASE_VERSION}."
|
||||||
|
echo "- Published assets: vociferate_${RELEASE_VERSION}_linux_amd64, vociferate_${RELEASE_VERSION}_linux_arm64, checksums.txt"
|
||||||
|
} >> "$SUMMARY_FILE"
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "## Release Failed"
|
||||||
|
echo
|
||||||
|
echo "- Tag: ${TAG_NAME:-unknown}"
|
||||||
|
echo "- Create or update release step did not complete successfully."
|
||||||
|
} >> "$SUMMARY_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 'Summary'
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [[ -s "$SUMMARY_FILE" ]]; then
|
||||||
|
cat "$SUMMARY_FILE"
|
||||||
|
else
|
||||||
|
echo 'No summary generated.'
|
||||||
|
fi
|
||||||
|
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: docker.io/catthehacker/ubuntu:act-latest
|
||||||
|
needs: release
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- asset_arch: amd64
|
||||||
|
run_command: ./vociferate
|
||||||
|
- asset_arch: arm64
|
||||||
|
run_command: qemu-aarch64-static ./vociferate
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
SUMMARY_FILE: ${{ runner.temp }}/validate-summary.md
|
||||||
|
steps:
|
||||||
|
- name: Checkout tagged revision
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: refs/tags/${{ needs.release.outputs.tag }}
|
||||||
|
|
||||||
|
- name: Install arm64 emulator
|
||||||
|
if: ${{ matrix.asset_arch == 'arm64' }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y qemu-user-static
|
||||||
|
|
||||||
|
- name: Download released binary
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ secrets.RELEASE_PAT }}
|
||||||
|
TAG_NAME: ${{ needs.release.outputs.tag }}
|
||||||
|
RELEASE_VERSION: ${{ needs.release.outputs.version }}
|
||||||
|
ASSET_ARCH: ${{ matrix.asset_arch }}
|
||||||
|
SERVER_URL: ${{ github.server_url }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
asset_name="vociferate_${RELEASE_VERSION}_linux_${ASSET_ARCH}"
|
||||||
|
asset_url="${SERVER_URL}/aether/vociferate/releases/download/${TAG_NAME}/${asset_name}"
|
||||||
|
|
||||||
|
curl --fail --location \
|
||||||
|
-H "Authorization: token ${TOKEN}" \
|
||||||
|
-o vociferate \
|
||||||
|
"$asset_url"
|
||||||
|
chmod +x vociferate
|
||||||
|
|
||||||
|
echo "asset_name=${asset_name}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Smoke test released binary
|
||||||
|
env:
|
||||||
|
RUN_COMMAND: ${{ matrix.run_command }}
|
||||||
|
TAG_NAME: ${{ needs.release.outputs.tag }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
${RUN_COMMAND} --help >/dev/null
|
||||||
|
|
||||||
|
recommend_stderr="$(mktemp)"
|
||||||
|
if ${RUN_COMMAND} --recommend --root . >/dev/null 2>"${recommend_stderr}"; then
|
||||||
|
echo "Expected --recommend to fail on the tagged release checkout" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
recommend_error="$(cat "${recommend_stderr}")"
|
||||||
|
case "${recommend_error}" in
|
||||||
|
*"unreleased section is empty"*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unexpected recommend failure output: ${recommend_error}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "## Released Binary Validation (${{ matrix.asset_arch }})"
|
||||||
|
echo
|
||||||
|
echo "- Release tag: ${TAG_NAME}"
|
||||||
|
echo "- Asset: ${asset_name}"
|
||||||
|
echo "- Binary executed successfully via --help."
|
||||||
|
echo "- --recommend failed as expected on the tagged checkout because Unreleased is empty."
|
||||||
} >> "$SUMMARY_FILE"
|
} >> "$SUMMARY_FILE"
|
||||||
|
|
||||||
- name: Summary
|
- name: Summary
|
||||||
@@ -150,10 +446,3 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo 'No summary generated.'
|
echo 'No summary generated.'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
publish:
|
|
||||||
needs: prepare
|
|
||||||
uses: ./.gitea/workflows/do-release.yml
|
|
||||||
with:
|
|
||||||
tag: ${{ needs.prepare.outputs.tag }}
|
|
||||||
secrets: inherit
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.26.1'
|
go-version-file: go.mod
|
||||||
check-latest: false
|
check-latest: false
|
||||||
cache: true
|
cache: true
|
||||||
cache-dependency-path: go.sum
|
cache-dependency-path: go.sum
|
||||||
@@ -124,7 +124,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.26.1'
|
go-version-file: go.mod
|
||||||
check-latest: false
|
check-latest: false
|
||||||
cache: true
|
cache: true
|
||||||
cache-dependency-path: go.sum
|
cache-dependency-path: go.sum
|
||||||
|
|||||||
26
AGENTS.md
26
AGENTS.md
@@ -4,15 +4,15 @@ This guide is for agentic coding partners that need to integrate the composite a
|
|||||||
|
|
||||||
## Source Of Truth
|
## Source Of Truth
|
||||||
|
|
||||||
Pin all action references to a released tag (for example `@v1.0.2`) and keep all vociferate references on the same tag in a workflow.
|
Pin all action references to a released tag (for example `@v1.1.0`) and keep all vociferate references on the same tag in a workflow.
|
||||||
|
|
||||||
Published composite actions:
|
Published composite actions:
|
||||||
|
|
||||||
- `https://git.hrafn.xyz/aether/vociferate@v1.0.2` (root action)
|
- `https://git.hrafn.xyz/aether/vociferate@v1.1.0` (root action)
|
||||||
- `https://git.hrafn.xyz/aether/vociferate/prepare@v1.0.2`
|
- `https://git.hrafn.xyz/aether/vociferate/prepare@v1.1.0`
|
||||||
- `https://git.hrafn.xyz/aether/vociferate/publish@v1.0.2`
|
- `https://git.hrafn.xyz/aether/vociferate/publish@v1.1.0`
|
||||||
- `https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.0.2`
|
- `https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.1.0`
|
||||||
- `https://git.hrafn.xyz/aether/vociferate/decorate-pr@v1.0.2`
|
- `https://git.hrafn.xyz/aether/vociferate/decorate-pr@v1.1.0`
|
||||||
|
|
||||||
## Action Selection Matrix
|
## Action Selection Matrix
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ Apply these checks before invoking actions:
|
|||||||
|
|
||||||
- Checkout repository first.
|
- Checkout repository first.
|
||||||
- For prepare/publish flows that depend on tags/history, use full history checkout (`fetch-depth: 0`).
|
- For prepare/publish flows that depend on tags/history, use full history checkout (`fetch-depth: 0`).
|
||||||
- Use valid credentials for release/comment API calls. On GitHub, `secrets.GITHUB_TOKEN` is used; on self-hosted Gitea, set `secrets.GITEA_TOKEN`.
|
- Use `secrets.RELEASE_PAT` for release/tag/update operations (prepare/publish/do-release) so tag pushes trigger downstream workflows reliably.
|
||||||
- `do-release` and `decorate-pr` now run preflight API checks and fail fast when token credentials are missing or insufficient.
|
- `do-release` and `decorate-pr` now run preflight API checks and fail fast when token credentials are missing or insufficient.
|
||||||
- Set required vars/secrets for coverage uploads:
|
- Set required vars/secrets for coverage uploads:
|
||||||
- `vars.ARTEFACT_BUCKET_NAME`
|
- `vars.ARTEFACT_BUCKET_NAME`
|
||||||
@@ -94,11 +94,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- id: prepare
|
- id: prepare
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/prepare@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/prepare@v1.1.0
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs: prepare
|
needs: prepare
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/.gitea/workflows/do-release.yml@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/.gitea/workflows/do-release.yml@v1.1.0
|
||||||
with:
|
with:
|
||||||
tag: ${{ needs.prepare.outputs.version }}
|
tag: ${{ needs.prepare.outputs.version }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
@@ -115,7 +115,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- id: publish
|
- id: publish
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/publish@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/publish@v1.1.0
|
||||||
with:
|
with:
|
||||||
version: v1.2.3
|
version: v1.2.3
|
||||||
```
|
```
|
||||||
@@ -136,7 +136,7 @@ jobs:
|
|||||||
- name: Run tests with coverage
|
- name: Run tests with coverage
|
||||||
run: go test -covermode=atomic -coverprofile=coverage.out ./...
|
run: go test -covermode=atomic -coverprofile=coverage.out ./...
|
||||||
- id: badge
|
- id: badge
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.1.0
|
||||||
with:
|
with:
|
||||||
artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }}
|
artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }}
|
||||||
artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }}
|
artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }}
|
||||||
@@ -159,12 +159,12 @@ jobs:
|
|||||||
- name: Run tests with coverage
|
- name: Run tests with coverage
|
||||||
run: go test -covermode=atomic -coverprofile=coverage.out ./...
|
run: go test -covermode=atomic -coverprofile=coverage.out ./...
|
||||||
- id: badge
|
- id: badge
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.1.0
|
||||||
with:
|
with:
|
||||||
artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }}
|
artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }}
|
||||||
artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }}
|
artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }}
|
||||||
- name: Decorate PR
|
- name: Decorate PR
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/decorate-pr@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/decorate-pr@v1.1.0
|
||||||
with:
|
with:
|
||||||
coverage-percentage: ${{ steps.badge.outputs.total }}
|
coverage-percentage: ${{ steps.badge.outputs.total }}
|
||||||
badge-url: ${{ steps.badge.outputs.badge-url }}
|
badge-url: ${{ steps.badge.outputs.badge-url }}
|
||||||
|
|||||||
19
CHANGELOG.md
19
CHANGELOG.md
@@ -13,6 +13,18 @@ A `### Breaking` section is used in addition to Keep a Changelog's standard sect
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
## [1.1.0] - 2026-03-21
|
||||||
|
|
||||||
|
### Breaking
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
- Added changelog gate validation to `decorate-pr` action for enforcing changelog updates on qualifying code changes.
|
- Added changelog gate validation to `decorate-pr` action for enforcing changelog updates on qualifying code changes.
|
||||||
- Changelog gate modes: `strict` (fails job on violation) and `soft` (warns via PR comment).
|
- Changelog gate modes: `strict` (fails job on violation) and `soft` (warns via PR comment).
|
||||||
- Docs-only PR exemption with customizable glob patterns for documentation files.
|
- Docs-only PR exemption with customizable glob patterns for documentation files.
|
||||||
@@ -30,6 +42,7 @@ A `### Breaking` section is used in addition to Keep a Changelog's standard sect
|
|||||||
- `publish` now extracts tagged release notes through the `vociferate` Go CLI instead of duplicating changelog section parsing in shell.
|
- `publish` now extracts tagged release notes through the `vociferate` Go CLI instead of duplicating changelog section parsing in shell.
|
||||||
- Composite actions now share a centralized `run-vociferate` orchestration flow, with binary-versus-source execution delegated through shared composite actions and single-use runtime/download logic folded back into `run-vociferate.binary`.
|
- Composite actions now share a centralized `run-vociferate` orchestration flow, with binary-versus-source execution delegated through shared composite actions and single-use runtime/download logic folded back into `run-vociferate.binary`.
|
||||||
- `run-vociferate` now contains both binary and source execution flows directly in a single action implementation, removing nested local action wrappers for better runner compatibility.
|
- `run-vociferate` now contains both binary and source execution flows directly in a single action implementation, removing nested local action wrappers for better runner compatibility.
|
||||||
|
- Release automation now requires `secrets.RELEASE_PAT` for prepare/publish/do-release operations instead of defaulting to `GITHUB_TOKEN`/`GITEA_TOKEN`.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
@@ -40,6 +53,7 @@ A `### Breaking` section is used in addition to Keep a Changelog's standard sect
|
|||||||
- Fixed version resolution in `do-release` workflow by moving version calculation before checkout, resolving from inputs/git tags, and always passing explicit version to `publish` action.
|
- Fixed version resolution in `do-release` workflow by moving version calculation before checkout, resolving from inputs/git tags, and always passing explicit version to `publish` action.
|
||||||
- Fixed tag detection in `do-release` to prioritize the tag at current HEAD (created by `prepare-release`) over the globally latest tag, ensuring correct version is detected when called from `prepare-release` workflow.
|
- Fixed tag detection in `do-release` to prioritize the tag at current HEAD (created by `prepare-release`) over the globally latest tag, ensuring correct version is detected when called from `prepare-release` workflow.
|
||||||
- Fixed `do-release` workflow_call resolution on Teacup runners by explicitly falling back to `needs.prepare.outputs.tag` and normalizing `%!t(string=...)` wrapped values before choosing a release tag.
|
- Fixed `do-release` workflow_call resolution on Teacup runners by explicitly falling back to `needs.prepare.outputs.tag` and normalizing `%!t(string=...)` wrapped values before choosing a release tag.
|
||||||
|
- Fixed release-chain triggering by using a PAT for release commit/tag pushes so downstream release workflows are triggered reliably.
|
||||||
- Made `publish` action version resolution more robust with clearer error messages when version input is missing and workflow is not running from a tag push.
|
- Made `publish` action version resolution more robust with clearer error messages when version input is missing and workflow is not running from a tag push.
|
||||||
- Fixed `do-release` workflow to always checkout the resolved release tag, eliminating conditional checkout logic that could skip the checkout when called from `prepare-release` workflow.
|
- Fixed `do-release` workflow to always checkout the resolved release tag, eliminating conditional checkout logic that could skip the checkout when called from `prepare-release` workflow.
|
||||||
- Pinned `securego/gosec` and `golang/govulncheck-action` to concrete version tags (`v2.22.4` and `v1.0.4`) so self-hosted Gitea runners can resolve them via direct git clone without relying on the GitHub Actions floating-tag API.
|
- Pinned `securego/gosec` and `golang/govulncheck-action` to concrete version tags (`v2.22.4` and `v1.0.4`) so self-hosted Gitea runners can resolve them via direct git clone without relying on the GitHub Actions floating-tag API.
|
||||||
@@ -154,9 +168,10 @@ A `### Breaking` section is used in addition to Keep a Changelog's standard sect
|
|||||||
- Project/automation rename from `releaseprep` to `vociferate` (entrypoint, package paths, outputs).
|
- Project/automation rename from `releaseprep` to `vociferate` (entrypoint, package paths, outputs).
|
||||||
- README guidance focused on primary cross-repository reuse workflows.
|
- README guidance focused on primary cross-repository reuse workflows.
|
||||||
|
|
||||||
[Unreleased]: https://git.hrafn.xyz/aether/vociferate/compare/v1.0.2...main
|
[Unreleased]: https://git.hrafn.xyz/aether/vociferate/compare/v1.1.0...main
|
||||||
|
[1.1.0]: https://git.hrafn.xyz/aether/vociferate/compare/v1.0.2...v1.1.0
|
||||||
[1.0.2]: https://git.hrafn.xyz/aether/vociferate/compare/v1.0.1...v1.0.2
|
[1.0.2]: https://git.hrafn.xyz/aether/vociferate/compare/v1.0.1...v1.0.2
|
||||||
[1.0.1]: https://git.hrafn.xyz/aether/vociferate/compare/v1.0.0...v1.0.1
|
[1.0.1]: https://git.hrafn.xyz/aether/vociferate/compare/v1.0.0...v1.0.1
|
||||||
[1.0.0]: https://git.hrafn.xyz/aether/vociferate/compare/v0.2.0...v1.0.0
|
[1.0.0]: https://git.hrafn.xyz/aether/vociferate/compare/v0.2.0...v1.0.0
|
||||||
[0.2.0]: https://git.hrafn.xyz/aether/vociferate/compare/v0.1.0...v0.2.0
|
[0.2.0]: https://git.hrafn.xyz/aether/vociferate/compare/v0.1.0...v0.2.0
|
||||||
[0.1.0]: https://git.hrafn.xyz/aether/vociferate/compare/2060af6...v0.1.0
|
[0.1.0]: https://git.hrafn.xyz/aether/vociferate/compare/81dced6...v0.1.0
|
||||||
|
|||||||
34
README.md
34
README.md
@@ -17,7 +17,7 @@ revision.
|
|||||||
## Use In Other Repositories
|
## Use In Other Repositories
|
||||||
|
|
||||||
Vociferate ships composite actions covering release preparation, release publication, coverage badge publishing, and pull request decoration.
|
Vociferate ships composite actions covering release preparation, release publication, coverage badge publishing, and pull request decoration.
|
||||||
Release tags now exist; pin all action and reusable-workflow references to the same released tag (for example, `@v1.0.2`) instead of `@main`.
|
Release tags now exist; pin all action and reusable-workflow references to the same released tag (for example, `@v1.1.0`) instead of `@main`.
|
||||||
|
|
||||||
For agentic coding partners, see [`AGENTS.md`](AGENTS.md) for a direct integration playbook, selection matrix, and copy-paste workflow patterns.
|
For agentic coding partners, see [`AGENTS.md`](AGENTS.md) for a direct integration playbook, selection matrix, and copy-paste workflow patterns.
|
||||||
|
|
||||||
@@ -41,13 +41,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- uses: https://git.hrafn.xyz/aether/vociferate/prepare@v1.0.2
|
- uses: https://git.hrafn.xyz/aether/vociferate/prepare@v1.1.0
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.version }}
|
version: ${{ inputs.version }}
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs: prepare
|
needs: prepare
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/.gitea/workflows/do-release.yml@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/.gitea/workflows/do-release.yml@v1.1.0
|
||||||
with:
|
with:
|
||||||
tag: ${{ needs.prepare.outputs.version }}
|
tag: ${{ needs.prepare.outputs.version }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
@@ -61,15 +61,16 @@ For repositories that embed the version inside source code, pass `version-file`
|
|||||||
and `version-pattern`:
|
and `version-pattern`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: https://git.hrafn.xyz/aether/vociferate/prepare@v1.0.2
|
- uses: https://git.hrafn.xyz/aether/vociferate/prepare@v1.1.0
|
||||||
with:
|
with:
|
||||||
|
token: ${{ secrets.RELEASE_PAT }}
|
||||||
version-file: internal/myapp/version/version.go
|
version-file: internal/myapp/version/version.go
|
||||||
version-pattern: 'const Version = "([^"]+)"'
|
version-pattern: 'const Version = "([^"]+)"'
|
||||||
git-add-files: CHANGELOG.md internal/myapp/version/version.go
|
git-add-files: CHANGELOG.md internal/myapp/version/version.go
|
||||||
```
|
```
|
||||||
|
|
||||||
`prepare` uses `github.token` internally for authenticated fetch/push operations,
|
`prepare` requires a PAT input for authenticated commit/push/tag operations.
|
||||||
so no token input is required.
|
Pass `token: ${{ secrets.RELEASE_PAT }}` when invoking the action.
|
||||||
|
|
||||||
### `publish` — create release with changelog notes
|
### `publish` — create release with changelog notes
|
||||||
|
|
||||||
@@ -85,7 +86,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/.gitea/workflows/do-release.yml@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/.gitea/workflows/do-release.yml@v1.1.0
|
||||||
with:
|
with:
|
||||||
tag: ${{ inputs.tag }}
|
tag: ${{ inputs.tag }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
@@ -96,21 +97,20 @@ Gitea/GitHub release with those notes. The `version` input is optional — when
|
|||||||
omitted it is derived from the current tag ref automatically.
|
omitted it is derived from the current tag ref automatically.
|
||||||
|
|
||||||
The reusable `Do Release` workflow now runs preflight checks before publish to
|
The reusable `Do Release` workflow now runs preflight checks before publish to
|
||||||
fail fast when the release token is missing or lacks API access. On
|
fail fast when the release token is missing or lacks API access. Set
|
||||||
self-hosted Gitea, set `secrets.GITEA_TOKEN`; on GitHub, `secrets.GITHUB_TOKEN`
|
`secrets.RELEASE_PAT` and use it for prepare/publish release operations.
|
||||||
is used automatically.
|
|
||||||
|
|
||||||
The `publish` action outputs `release-id` so you can upload additional release
|
The `publish` action outputs `release-id` so you can upload additional release
|
||||||
assets after it runs:
|
assets after it runs:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- id: publish
|
- id: publish
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/publish@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/publish@v1.1.0
|
||||||
|
|
||||||
- name: Upload my binary
|
- name: Upload my binary
|
||||||
run: |
|
run: |
|
||||||
curl --fail-with-body -X POST \
|
curl --fail-with-body -X POST \
|
||||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.RELEASE_PAT }}" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
"${{ github.api_url }}/repos/${{ github.repository }}/releases/${{ steps.publish.outputs.release-id }}/assets?name=myapp" \
|
"${{ github.api_url }}/repos/${{ github.repository }}/releases/${{ steps.publish.outputs.release-id }}/assets?name=myapp" \
|
||||||
--data-binary "@dist/myapp"
|
--data-binary "@dist/myapp"
|
||||||
@@ -125,7 +125,7 @@ Run your coverage tests first, then call the action to generate `coverage.html`,
|
|||||||
run: go test -covermode=atomic -coverprofile=coverage.out ./...
|
run: go test -covermode=atomic -coverprofile=coverage.out ./...
|
||||||
|
|
||||||
- id: coverage
|
- id: coverage
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.1.0
|
||||||
with:
|
with:
|
||||||
artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }}
|
artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }}
|
||||||
artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }}
|
artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }}
|
||||||
@@ -150,14 +150,14 @@ with a clear message when token permissions are insufficient.
|
|||||||
run: go test -covermode=atomic -coverprofile=coverage.out ./...
|
run: go test -covermode=atomic -coverprofile=coverage.out ./...
|
||||||
|
|
||||||
- id: coverage
|
- id: coverage
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/coverage-badge@v1.1.0
|
||||||
with:
|
with:
|
||||||
artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }}
|
artefact-bucket-name: ${{ vars.ARTEFACT_BUCKET_NAME }}
|
||||||
artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }}
|
artefact-bucket-endpoint: ${{ vars.ARTEFACT_BUCKET_ENDPONT }}
|
||||||
|
|
||||||
- name: Decorate pull request
|
- name: Decorate pull request
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/decorate-pr@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/decorate-pr@v1.1.0
|
||||||
with:
|
with:
|
||||||
coverage-percentage: ${{ steps.coverage.outputs.total }}
|
coverage-percentage: ${{ steps.coverage.outputs.total }}
|
||||||
badge-url: ${{ steps.coverage.outputs.badge-url }}
|
badge-url: ${{ steps.coverage.outputs.badge-url }}
|
||||||
@@ -170,7 +170,7 @@ Enable changelog validation to enforce that code changes include `Unreleased` ch
|
|||||||
```yaml
|
```yaml
|
||||||
- name: Decorate pull request with changelog gate
|
- name: Decorate pull request with changelog gate
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/decorate-pr@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/decorate-pr@v1.1.0
|
||||||
with:
|
with:
|
||||||
coverage-percentage: ${{ steps.coverage.outputs.total }}
|
coverage-percentage: ${{ steps.coverage.outputs.total }}
|
||||||
badge-url: ${{ steps.coverage.outputs.badge-url }}
|
badge-url: ${{ steps.coverage.outputs.badge-url }}
|
||||||
@@ -196,7 +196,7 @@ Decision outputs enable downstream workflow logic:
|
|||||||
- name: Decorate PR and check gate
|
- name: Decorate PR and check gate
|
||||||
id: decorate
|
id: decorate
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
uses: https://git.hrafn.xyz/aether/vociferate/decorate-pr@v1.0.2
|
uses: https://git.hrafn.xyz/aether/vociferate/decorate-pr@v1.1.0
|
||||||
with:
|
with:
|
||||||
coverage-percentage: ${{ steps.coverage.outputs.total }}
|
coverage-percentage: ${{ steps.coverage.outputs.total }}
|
||||||
badge-url: ${{ steps.coverage.outputs.badge-url }}
|
badge-url: ${{ steps.coverage.outputs.badge-url }}
|
||||||
|
|||||||
@@ -42,6 +42,11 @@ inputs:
|
|||||||
custom version-file.
|
custom version-file.
|
||||||
required: false
|
required: false
|
||||||
default: 'CHANGELOG.md release-version'
|
default: 'CHANGELOG.md release-version'
|
||||||
|
token:
|
||||||
|
description: >
|
||||||
|
Personal access token used to authenticate commit, push, and tag
|
||||||
|
operations. Required to ensure downstream workflows trigger on tag push.
|
||||||
|
required: true
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
version:
|
version:
|
||||||
@@ -114,7 +119,7 @@ runs:
|
|||||||
- name: Commit and push release
|
- name: Commit and push release
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ github.token }}
|
TOKEN: ${{ inputs.token }}
|
||||||
GIT_USER_NAME: ${{ inputs.git-user-name }}
|
GIT_USER_NAME: ${{ inputs.git-user-name }}
|
||||||
GIT_USER_EMAIL: ${{ inputs.git-user-email }}
|
GIT_USER_EMAIL: ${{ inputs.git-user-email }}
|
||||||
GIT_ADD_FILES: ${{ inputs.git-add-files }}
|
GIT_ADD_FILES: ${{ inputs.git-add-files }}
|
||||||
@@ -124,6 +129,11 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ -z "${TOKEN:-}" ]]; then
|
||||||
|
echo "A release PAT is required. Provide inputs.token (for example secrets.RELEASE_PAT)." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
case "$GITHUB_SERVER_URL" in
|
case "$GITHUB_SERVER_URL" in
|
||||||
https://*)
|
https://*)
|
||||||
authed_remote="https://oauth2:${TOKEN}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git"
|
authed_remote="https://oauth2:${TOKEN}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git"
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ description: >
|
|||||||
inputs:
|
inputs:
|
||||||
token:
|
token:
|
||||||
description: >
|
description: >
|
||||||
Token used to authenticate release API calls. Defaults to the
|
Personal access token used to authenticate release API calls.
|
||||||
workflow token.
|
Required to support release updates across workflow boundaries.
|
||||||
required: false
|
required: true
|
||||||
default: ''
|
|
||||||
version:
|
version:
|
||||||
description: >
|
description: >
|
||||||
Semantic version to publish (with or without leading v). When omitted,
|
Semantic version to publish (with or without leading v). When omitted,
|
||||||
@@ -91,41 +90,66 @@ runs:
|
|||||||
id: create-release
|
id: create-release
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ inputs.token != '' && inputs.token || github.token }}
|
TOKEN: ${{ inputs.token }}
|
||||||
TAG_NAME: ${{ steps.resolve-version.outputs.tag }}
|
TAG_NAME: ${{ steps.resolve-version.outputs.tag }}
|
||||||
RELEASE_NOTES_FILE: ${{ steps.write-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_REPOSITORY: ${{ github.repository }}
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
parse_release_id() {
|
||||||
|
local json_file="$1"
|
||||||
|
|
||||||
|
if command -v python3 >/dev/null 2>&1; then
|
||||||
|
python3 -c 'import json, sys; payload = json.load(open(sys.argv[1], encoding="utf-8")); value = payload.get("id"); print(value if isinstance(value, int) else "")' "$json_file"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fallback for environments without python3.
|
||||||
|
sed -n 's/.*"id"[[:space:]]*:[[:space:]]*\([0-9][0-9]*\).*/\1/p' "$json_file" | head -n 1
|
||||||
|
}
|
||||||
|
|
||||||
|
raw_token="$(printf '%s' "${TOKEN:-}" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||||
|
if [[ "$raw_token" =~ ^%\!t\(string=(.*)\)$ ]]; then
|
||||||
|
raw_token="${BASH_REMATCH[1]}"
|
||||||
|
fi
|
||||||
|
api_token="$(printf '%s' "$raw_token" | sed 's/^[[:space:]]\+//; s/[[:space:]]\+$//')"
|
||||||
|
|
||||||
|
if [[ -z "$api_token" ]]; then
|
||||||
|
echo "inputs.token is required (set to secrets.RELEASE_PAT)." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
release_notes="$(cat "$RELEASE_NOTES_FILE")"
|
release_notes="$(cat "$RELEASE_NOTES_FILE")"
|
||||||
escaped_release_notes="$(printf '%s' "$release_notes" | sed 's/\\/\\\\/g; s/"/\\"/g; :a;N;$!ba;s/\n/\\n/g')"
|
escaped_release_notes="$(printf '%s' "$release_notes" | sed 's/\\/\\\\/g; s/"/\\"/g; :a;N;$!ba;s/\n/\\n/g')"
|
||||||
release_api="${GITHUB_API_URL:-${GITHUB_SERVER_URL%/}/api/v1}/repos/${GITHUB_REPOSITORY}/releases"
|
release_api="${GITHUB_API_URL:-${GITHUB_SERVER_URL%/}/api/v1}/repos/${GITHUB_REPOSITORY}/releases"
|
||||||
release_by_tag_api="${release_api}/tags/${TAG_NAME}"
|
release_by_tag_api="${release_api}/tags/${TAG_NAME}"
|
||||||
|
|
||||||
status_code="$(curl -sS -o release-existing.json -w '%{http_code}' \
|
status_code="$(curl -sS -o release-existing.json -w '%{http_code}' \
|
||||||
-H "Authorization: token ${TOKEN}" \
|
-H "Authorization: token ${api_token}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
"${release_by_tag_api}")"
|
"${release_by_tag_api}")"
|
||||||
|
|
||||||
if [[ "$status_code" == "200" ]]; then
|
if [[ "$status_code" == "200" ]]; then
|
||||||
existing_release_id="$(sed -n 's/.*"id"[[:space:]]*:[[:space:]]*\([0-9][0-9]*\).*/\1/p' release-existing.json | head -n 1)"
|
existing_release_id="$(parse_release_id release-existing.json)"
|
||||||
if [[ -z "$existing_release_id" ]]; then
|
if [[ -z "$existing_release_id" ]]; then
|
||||||
echo "Failed to parse existing release id for ${TAG_NAME}" >&2
|
echo "Failed to parse existing release id for ${TAG_NAME}" >&2
|
||||||
cat release-existing.json >&2
|
cat release-existing.json >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl --fail-with-body \
|
if ! curl --fail-with-body \
|
||||||
-X PATCH \
|
-X PATCH \
|
||||||
-H "Authorization: token ${TOKEN}" \
|
-H "Authorization: token ${api_token}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
"${release_api}/${existing_release_id}" \
|
"${release_api}/${existing_release_id}" \
|
||||||
--data "{\"tag_name\":\"${TAG_NAME}\",\"target\":\"${GITHUB_SHA}\",\"name\":\"${TAG_NAME}\",\"body\":\"${escaped_release_notes}\",\"draft\":false,\"prerelease\":false}" \
|
--data "{\"tag_name\":\"${TAG_NAME}\",\"name\":\"${TAG_NAME}\",\"body\":\"${escaped_release_notes}\",\"draft\":false,\"prerelease\":false}" \
|
||||||
--output release.json
|
--output release.json; then
|
||||||
|
cat release.json >&2 || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "id=$existing_release_id" >> "$GITHUB_OUTPUT"
|
echo "id=$existing_release_id" >> "$GITHUB_OUTPUT"
|
||||||
elif [[ "$status_code" != "404" ]]; then
|
elif [[ "$status_code" != "404" ]]; then
|
||||||
@@ -133,15 +157,18 @@ runs:
|
|||||||
cat release-existing.json >&2
|
cat release-existing.json >&2
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
curl --fail-with-body \
|
if ! curl --fail-with-body \
|
||||||
-X POST \
|
-X POST \
|
||||||
-H "Authorization: token ${TOKEN}" \
|
-H "Authorization: token ${api_token}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
"${release_api}" \
|
"${release_api}" \
|
||||||
--data "{\"tag_name\":\"${TAG_NAME}\",\"target\":\"${GITHUB_SHA}\",\"name\":\"${TAG_NAME}\",\"body\":\"${escaped_release_notes}\",\"draft\":false,\"prerelease\":false}" \
|
--data "{\"tag_name\":\"${TAG_NAME}\",\"name\":\"${TAG_NAME}\",\"body\":\"${escaped_release_notes}\",\"draft\":false,\"prerelease\":false}" \
|
||||||
--output release.json
|
--output release.json; then
|
||||||
|
cat release.json >&2 || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
release_id="$(sed -n 's/.*"id"[[:space:]]*:[[:space:]]*\([0-9][0-9]*\).*/\1/p' release.json | head -n 1)"
|
release_id="$(parse_release_id release.json)"
|
||||||
if [[ -z "$release_id" ]]; then
|
if [[ -z "$release_id" ]]; then
|
||||||
echo "Failed to parse release id from API response" >&2
|
echo "Failed to parse release id from API response" >&2
|
||||||
cat release.json >&2
|
cat release.json >&2
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.0.2
|
1.1.0
|
||||||
|
|||||||
Reference in New Issue
Block a user