From 8710fb6ef1a776cbea5e10b871551ef6df6d2847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Mon, 16 Dec 2024 18:44:07 +0000 Subject: [PATCH 1/3] Adds version override inputs back for cases where version-info wasn't uploaded for some reason. --- .github/workflows/github-release.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index 3d87b64de..0b7c4eab3 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -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 @@ -83,6 +91,19 @@ jobs: - name: Parse version info 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." + if [[ -z "$version_name" || -z "$version_number" ]]; then + echo "::error::version-info.json not found and version-name/version-number are empty. Cannot proceed with release." + exit 1 + fi + + echo "version_number=$version_number" >> $GITHUB_OUTPUT + echo "version_name=$version_name" >> $GITHUB_OUTPUT + 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") From 611570bae38b9ed4e7da6321514279965ef9ee81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Mon, 16 Dec 2024 19:35:21 +0000 Subject: [PATCH 2/3] Set default values when inputs aren't provided --- .github/workflows/github-release.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index 0b7c4eab3..eca51bda2 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -89,17 +89,29 @@ 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." - if [[ -z "$version_name" || -z "$version_number" ]]; then - echo "::error::version-info.json not found and version-name/version-number are empty. Cannot proceed with release." - exit 1 + + 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 From 0858cc130fe6edb5f4a0539fedff45217e60bfa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lison=20Fernandes?= Date: Mon, 16 Dec 2024 19:50:33 +0000 Subject: [PATCH 3/3] Output summary message when we use default version values --- .github/workflows/github-release.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index eca51bda2..e314d9fa4 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -165,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