Generate Release Notes #25
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-License-Identifier: Apache-2.0 | |
name: "Generate Release Notes" | |
on: | |
workflow_dispatch: | |
inputs: | |
release-id: | |
description: "Release Version Number (ex: 0.59.2):" | |
type: string | |
required: true | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
actions: read | |
jobs: | |
generate-release-notes: | |
name: Generate Release Notes | |
runs-on: hiero-network-node-linux-medium | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- name: Validate and Correct Release Identifier | |
id: validate | |
run: | | |
release_identifier="${{ inputs.release-id }}" | |
echo "Input release identifier: '${release_identifier}'" | |
# Trim leading/trailing spaces | |
release_identifier="$(echo -n "${release_identifier}" | xargs)" | |
# Remove leading "v" if present | |
release_identifier="${release_identifier#v}" | |
echo "Corrected release identifier: ${release_identifier}" | |
# Regular expression for semantic versioning (X.Y.Z) | |
semver_regex="^[0-9]+\\.[0-9]+\\.[0-9]+$" | |
if [[ ! "${release_identifier}" =~ ${semver_regex} ]]; then | |
echo "Error: Invalid release version format after correction. Expected format: X.Y.Z (e.g., 0.59.2)" | |
exit 1 | |
fi | |
echo "Release identifier is valid: ${release_identifier}" | |
echo "release-identifier=${release_identifier}" >> ${GITHUB_OUTPUT} | |
echo "Validated Input: ${release_identifier}" >> ${GITHUB_STEP_SUMMARY} | |
- name: Checkout Code | |
id: checkout_code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: "0" | |
ref: main | |
token: ${{ secrets.GH_ACCESS_TOKEN }} | |
- name: Validate Tag Exists | |
run: | | |
tag="v${{ steps.validate.outputs.release-identifier }}" | |
echo "Checking if tag ${tag} exists..." | |
# Check if the tag exists in the repository | |
git fetch --tags | |
if git rev-parse "$tag" >/dev/null 2>&1; then | |
echo "Tag ${tag} found in repo." >> ${GITHUB_STEP_SUMMARY} | |
else | |
echo "Error: Tag ${tag} does not exist in repo." >> ${GITHUB_STEP_SUMMARY} | |
exit 1 | |
fi | |
- name: Git-Semver Setup Action | |
uses: DJ-BBot/setup-git-semver@91baf2ca207495aa35db3441038ddeae2b6904c7 # v1.0.2 | |
- name: Create Release Notes - Markdown Format | |
run: | | |
echo "" | |
echo "Release Notes (Markdown Formatted):" | |
echo "" | |
git-semver log --markdown "${{ steps.validate.outputs.release-identifier }}" >> ${GITHUB_STEP_SUMMARY} | |
echo "" | |
echo "Successfully created release notes!" >> ${GITHUB_STEP_SUMMARY} | |
- name: Create Release Notes - JSON Structure | |
run: | | |
echo "Release Notes (JSON Structure):" | |
git-semver log "${{ steps.validate.outputs.release-identifier }}" |