From f26219b7334f85ba20c5a77a4f05a817cadb7eef Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Mon, 7 Aug 2023 18:53:04 +0300 Subject: [PATCH] feat: add checks and debug for sem-release - add one more debug message - ensure the NEXT_VERSION is not empty before proceeding to release This contribution is part of the [FC-0012 project](https://openedx.atlassian.net/l/cp/XGS0iCcQ) which is sparked by the [Translation Infrastructure update OEP-58](https://open-edx-proposals.readthedocs.io/en/latest/architectural-decisions/oep-0058-arch-translations-management.html#specification). --- .github/workflows/release.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7b28a58..4cab2ed 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,21 +13,31 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + - name: semantic release env: GITHUB_TOKEN: ${{ github.token }} run: | # Run in dry-run mode to determine the next tag version and store it in semantic-release-next-version.txt - npx semantic-release@21.0.7 --dry-run | tee semantic-release-dry-run-output.txt - cat semantic-release-dry-run-output.txt \ - | grep -o 'Skip v.* tag creation in dry-run mode' \ - | sed -e 's/^Skip //' | sed -e 's/ tag creation in dry-run mode$//' \ - | tee semantic-release-next-version.txt + npx semantic-release@21.0.7 --dry-run | tee semantic-release-next-version.txt + + NEXT_VERSION=$( + cat semantic-release-next-version.txt | \ + grep -o 'Skip v.* tag creation in dry-run mode' \ + | sed -e 's/^Skip //' | sed -e 's/ tag creation in dry-run mode$//' + ) - echo "DEBUG: Next version is '$(cat semantic-release-next-version.txt)'" # Debug version number + echo "DEBUG: Next version is '$NEXT_VERSION'" # Debug version number + + if [ -z "$NEXT_VERSION" ]; then + echo "ERROR: Could not determine next version from semantic-release dry-run output." + exit 1 + fi # Hardcode the next tag version in the atlas script - sed -i -e "s/_ATLAS_VERSION=.*/_ATLAS_VERSION=\"$(cat semantic-release-next-version.txt)\" # Tagged by release.yml/" atlas + sed -i -e "s/_ATLAS_VERSION=.*/_ATLAS_VERSION=\"$NEXT_VERSION\" # Tagged by release.yml/" atlas + + echo "DEBUG: 'atlas --version' output is '$(./atlas --version)'" # Debug version number # Actually create the tag and upload the atlas script npx semantic-release@21.0.7