From deb1aafcb5ee36c82b66a3d65a4bf721f282e1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=85=8E=E9=A5=BC=E6=9E=9C=E5=AD=90=E5=8D=B7=E9=B2=A8?= =?UTF-8?q?=E9=B1=BC=E8=BE=A3=E6=A4=92?= Date: Mon, 30 Dec 2024 18:44:19 +0800 Subject: [PATCH] chore: improve auto-tag workflow with enhanced output verification and debugging - Updated the output redirection for the generated version to use quotes for better compatibility. - Enhanced debug output to provide clearer visibility into step and job outputs, aiding in troubleshooting. - Added a verification step to display the contents of GITHUB_OUTPUT, ensuring the version value is correctly set before proceeding to the release job. - Refined the conditional execution for the release job to ensure it runs only when the auto-tag job succeeds and a version is generated. --- .github/workflows/auto-tag.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml index ab5df6d..01aba01 100644 --- a/.github/workflows/auto-tag.yml +++ b/.github/workflows/auto-tag.yml @@ -37,7 +37,7 @@ jobs: new_patch=$((patch + 1)) new_version="$major.$minor.$new_patch" fi - echo "version=$new_version" >> $GITHUB_OUTPUT + echo "version=$new_version" >> "$GITHUB_OUTPUT" echo "Generated version: $new_version" - name: Validate version @@ -62,13 +62,28 @@ jobs: - name: Debug output run: | - echo "Version output: ${{ steps.get_latest_tag.outputs.version }}" - echo "Job outputs: ${{ toJSON(needs.auto-tag.outputs) }}" - echo "::debug::Version value: ${{ steps.get_latest_tag.outputs.version }}" + echo "Step outputs:" + echo " version: ${{ steps.get_latest_tag.outputs.version }}" + echo "Job outputs:" + echo " all: ${{ toJSON(job.outputs) }}" + echo " direct: ${{ job.outputs.version }}" + echo "Needs outputs:" + echo " all: ${{ toJSON(needs) }}" + echo "::debug::Raw version value: ${{ steps.get_latest_tag.outputs.version }}" + + - name: Verify outputs + run: | + echo "GITHUB_OUTPUT contents:" + cat $GITHUB_OUTPUT + echo "---" + echo "Direct version value: ${{ steps.get_latest_tag.outputs.version }}" release: needs: auto-tag - if: success() && needs.auto-tag.outputs.version != '' + if: | + always() && + needs.auto-tag.result == 'success' && + needs.auto-tag.outputs.version != '' uses: ./.github/workflows/release.yml with: version: ${{ needs.auto-tag.outputs.version }}