diff --git a/.github/workflows/release-go-module.yml b/.github/workflows/release-go-module.yml index ea9abca24..57bbb3cd7 100644 --- a/.github/workflows/release-go-module.yml +++ b/.github/workflows/release-go-module.yml @@ -25,7 +25,9 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - fetch-tags: true + - name: Fetch all tags + run: | + git fetch --tags - name: Extract Package Name from Tag id: extract_package_name run: | @@ -48,7 +50,7 @@ jobs: # Find the latest tag for the same package that is not the current tag LAST_TAG=$(git describe --abbrev=0 --match "$PACKAGE_NAME/v*" --tags $(git rev-list --tags --skip=1 --max-count=1)) - echo "Last tag: $LAST_TAG" + echo "Last tag: ${LAST_TAG}" # If no previous tag is found, use the initial commit as the reference if [ -z "$LAST_TAG" ]; then @@ -58,6 +60,7 @@ jobs: # Extract the version part of the last tag LAST_TAG_VERSION=$(echo "$LAST_TAG" | cut -d'/' -f2) echo "Last tag version: $LAST_TAG_VERSION" + echo "LAST_TAG_VERSION=${LAST_TAG_VERSION}" >> $GITHUB_ENV # Get the commits between the last tag and the current tag COMMITS=$(git log "$LAST_TAG..$PACKAGE_NAME/$VERSION" --pretty=format:"- %s (%h)") @@ -82,9 +85,9 @@ jobs: id: check_breaking_changes run: | set +e # Disable exit on error to capture output even if the command fails - echo "Last tag version: ${LAST_TAG_VERSION}" + echo "Last tag version: ${{ env.LAST_TAG_VERSION }}" echo "Current tag version: ${VERSION}" - BREAKING_CHANGES=$(gorelease -base=${LAST_TAG_VERSION} -version=${VERSION} 2>&1) + BREAKING_CHANGES=$(gorelease -base=${{ env.last_tag_version }} -version=${VERSION} 2>&1) echo "Breaking changes: ${BREAKING_CHANGES}" set -e # Re-enable exit on error for the subsequent steps echo "BREAKING_CHANGES<> $GITHUB_ENV