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

[PM-11598] chore: Add version overrides to GitHub Release workflow #1213

Merged
merged 3 commits into from
Dec 17, 2024
Merged
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
42 changes: 42 additions & 0 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ on:
description: 'GitHub Action Run ID containing artifacts'
required: true
type: string
version-name:
description: 'Version Name Override - E.g. "2024.11.1"'
required: true
type: string
version-number:
description: 'Version Number Override - E.g. "123456"'
required: true
type: string
draft:
description: 'Create as draft release'
type: boolean
Expand Down Expand Up @@ -81,8 +89,33 @@ jobs:
run: ./Scripts/download-artifacts.sh $ARTIFACTS_PATH $ARTIFACT_RUN_ID

- name: Parse version info
env:
_VERSION_NAME: ${{ inputs.version-name }}
_VERSION_NUMBER: ${{ inputs.version-number }}
id: version_info
run: |
if [ ! -f ARTIFACTS_PATH/version_info.zip ]; then
echo "::warning::version-version.zip not found. Confirm why the build workflow skipped uploading it."

version_name="$_VERSION_NAME"
version_number="$_VERSION_NUMBER"
if [[ -z "$_VERSION_NAME" ]]; then
echo "::warning::version name override input is empty. Using default value."
version_name="0.0.0"
fi

if [[ -z "$_VERSION_NUMBER" ]]; then
echo "::warning::version number override input is empty. Using default value."
version_number="0"
fi

echo "version_number=$version_number" >> $GITHUB_OUTPUT
echo "version_name=$version_name" >> $GITHUB_OUTPUT
echo "Version: $version_name ($version_number)"
exit 0
fi

# version-info.zip was found, extracting info
unzip -o "$ARTIFACTS_PATH/version-info.zip" -d "tmp"
filepath="tmp/version-info/version_info.json"
version_name=$(jq -r '.version_name' "$filepath")
Expand Down Expand Up @@ -132,10 +165,19 @@ jobs:
RELEASE_BRANCH: ${{ steps.get_release_branch.outputs.release_branch }}
LAST_RELEASE_TAG: ${{ steps.get_last_tag.outputs.last_release_id }}
RELEASE_URL: ${{ steps.update_release_description.outputs.release_url }}
VERSION_NAME: ${{ steps.version_info.outputs.version_name }}
VERSION_NUMBER: ${{ steps.version_info.outputs.version_number }}
run: |
echo "# :fish_cake: Release ready at:" >> $GITHUB_STEP_SUMMARY
echo "$RELEASE_URL" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [[ "$VERSION_NAME" == "0.0.0" || "$VERSION_NUMBER" == "0" ]]; then
echo "> [!CAUTION]" >> $GITHUB_STEP_SUMMARY
echo "> Version name or number wasn't previously found and a default value was used. You'll need to manually update the release Title, Tag and Description, specifically, the "Full Changelog" link." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
fi

echo ":clipboard: Confirm that the defined GitHub Release options are correct:" >> $GITHUB_STEP_SUMMARY
echo " * :bookmark: New tag name: \`$RELEASE_TAG\`" >> $GITHUB_STEP_SUMMARY
echo " * :palm_tree: Target branch: \`$RELEASE_BRANCH\`" >> $GITHUB_STEP_SUMMARY
Expand Down
Loading