Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Release Note Generation #1227

Open
wants to merge 1 commit into
base: release-process-enhancement
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/release-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,21 @@ jobs:
tag_name="${{ env.kuadrantOperatorTag }}"
git tag $tag_name
git push origin $tag_name
- name: Generate release body
id: generate_release_body
run: |
GITHUB_TOKEN=${{ secrets.KUADRANT_WORKFLOWS_PAT }} bash ./utils/release/github-release-changelog.sh
- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: ${{ env.kuadrantOperatorTag }}
tag_name: ${{ env.kuadrantOperatorTag }}
body: "${{ env.releaseBody }}"
generate_release_notes: true
# The generate of release notes does not pick up the correct tag to compare.
# There is an open PR within softprops/action-gh-release that would solve the problem.
# Till then we cannot use the generate release notes feature.
# https://github.com/softprops/action-gh-release/pull/372
generate_release_notes: false
target_commitish: ${{ env.releaseBranch }}
prerelease: ${{ env.prerelease }}
39 changes: 39 additions & 0 deletions utils/release/github-release-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

# Access token will be required. Check to ensure that is it provied
if [[ -z "$GITHUB_TOKEN" ]]; then
echo "GITHUB_TOKEN most be set"
fi
auth_header="-H Authorization: Bearer $GITHUB_TOKEN"

script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source $script_dir/shared.sh

# Get latest release version
log "Getti previous release version tag"
previous_tag_name=$(curl -L "https://api.github.com/repos/kuadrant/kuadrant-operator/releases/latest" -H "Accept: apllication/vnd.github+json" | yq '.tag_name')
log "Previous released version is $previous_tag_name"

# Get current release tag
log "Getting this releases tag"
release_tag=$KUADRANT_OPERATOR_TAG
log "Release in progress for $KUADRANT_OPERATOR_TAG"

# Generate the release change log
log "Generate release change log"
payload=$(cat <<EOF
{"tag_name": "$release_tag","previous_tag_name": "$previous_tag_name"}
EOF
)

data=$(curl -L "https://api.github.com/repos/kuadrant/kuadrant-operator/releases/generate-notes" -X POST -H "Accept: apllication/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" -d "$payload")

release_body=$(echo $data | yq '.body')

if [[ $_log == "1" ]]; then
log "releaseBody=$release_body"
fi

if [[ $dry_run == "0" ]]; then
echo "releaseBody=$release_body" >> "$GITHUB_ENV"
fi
Loading