Skip to content

FIX: Release Note Generation #1227

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

Merged
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
11 changes: 10 additions & 1 deletion .github/workflows/release-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,22 @@ 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
# TODO: https://github.com/Kuadrant/kuadrant-operator/issues/1229
# 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a TODO annotation so we can easily track this?

generate_release_notes: false
target_commitish: ${{ env.releaseBranch }}
prerelease: ${{ env.prerelease }}
40 changes: 40 additions & 0 deletions utils/release/github-release-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

# Access token will be required. Check to ensure that is it provied
if [[ -z "$GITHUB_TOKEN" ]]; then
echo "GITHUB_TOKEN must 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 "Getting 'latest' 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 "'latest' 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_data=$(echo $data | yq '.body')
release_body="**This release enables installations of Authorino Operator v$AUTHORINO_OPERATOR_VERSION, Limitador Operator v$LIMITADOR_OPERATOR_VERSION, DNS Operator v$DNS_OPERATOR_VERSION, WASM Shim v$WASM_SHIM_VERSION and ConsolePlugin $CONSOLEPLUGIN_URL**$release_body_data"

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

if [[ $dry_run == "0" ]]; then
echo "releaseBody=$release_body" >> "$GITHUB_ENV"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This releaseBody is shadowing same GITHUB_ENV added from load_github_envvar.sh. Should we remove releaseBody from load_github_envvar.sh??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking, I have a feeling we can't remove it from the load_github_envvar.sh, but might need to rename it.

fi
3 changes: 0 additions & 3 deletions utils/release/load_github_envvar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ source $script_dir/shared.sh

log "Loading Environment Variables"

releaseBody="**This release enables installations of Authorino Operator v$AUTHORINO_OPERATOR_VERSION, Limitador Operator v$LIMITADOR_OPERATOR_VERSION, DNS Operator v$DNS_OPERATOR_VERSION, WASM Shim v$WASM_SHIM_VERSION and ConsolePlugin $CONSOLEPLUGIN_URL**"
releaseBranch="release-$(echo "$KUADRANT_OPERATOR_TAG" | sed -E 's/^(v[0-9]+\.[0-9]+).*/\1/')"

prerelease=false
Expand All @@ -21,14 +20,12 @@ fi

if [[ $_log == "1" ]]; then
log "kuadrantOperatorTag=$KUADRANT_OPERATOR_TAG"
log "releaseBody=$releaseBody"
log "prerelease=$prerelease"
log "releaseBranch=$releaseBranch"
fi

if [[ $dry_run == "0" ]]; then
echo "kuadrantOperatorTag=$KUADRANT_OPERATOR_TAG" >> "$GITHUB_ENV"
echo "releaseBody=$releaseBody" >> "$GITHUB_ENV"
echo "prerelease=$prerelease" >> "$GITHUB_ENV"
echo "releaseBranch=$releaseBranch" >> "$GITHUB_ENV"
fi
Loading