From 65b32d4b878de1f47a071e675e05831e8a9eba6c Mon Sep 17 00:00:00 2001 From: LuQQiu Date: Tue, 17 Sep 2024 13:17:05 -0700 Subject: [PATCH] fix: fix cargo release tag checkout (#2902) --- .github/workflows/cargo-publish.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cargo-publish.yml b/.github/workflows/cargo-publish.yml index faa1c51957..4275f554c8 100644 --- a/.github/workflows/cargo-publish.yml +++ b/.github/workflows/cargo-publish.yml @@ -33,9 +33,19 @@ jobs: - uses: Swatinem/rust-cache@v2 with: workspaces: rust - - name: Checkout specified tag + - name: Verify and checkout specified tag if: github.event_name == 'workflow_dispatch' - run: git checkout ${{ github.event.inputs.tag }} + run: | + git fetch --all --tags + if git rev-parse ${{ github.event.inputs.tag }} >/dev/null 2>&1; then + git checkout ${{ github.event.inputs.tag }} + echo "Successfully checked out tag ${{ github.event.inputs.tag }}" + else + echo "Error: Tag ${{ github.event.inputs.tag }} does not exist" + echo "Available tags:" + git tag -l + exit 1 + fi - name: Install dependencies run: | sudo apt update