Skip to content

Commit baabf9e

Browse files
committed
fix(ci): checkout release commit by SHA instead of tag ref
Publish jobs were failing because actions/checkout tried to fetch the newly pushed tag before GitHub replicated it. Using the commit SHA from the version job eliminates the race condition.
1 parent 01304fd commit baabf9e

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
outputs:
3636
version: ${{ steps.bump.outputs.version }}
3737
skip: ${{ steps.check.outputs.skip }}
38+
sha: ${{ steps.push.outputs.sha }}
3839
steps:
3940
- uses: actions/checkout@v4
4041
with:
@@ -89,6 +90,7 @@ jobs:
8990
9091
- name: Commit and tag
9192
if: steps.check.outputs.skip != 'true'
93+
id: push
9294
run: |
9395
VERSION="${{ steps.bump.outputs.version }}"
9496
git config user.name "github-actions[bot]"
@@ -97,6 +99,7 @@ jobs:
9799
git commit -m "release: v${VERSION}"
98100
git tag "v${VERSION}"
99101
git push origin main --follow-tags
102+
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
100103
101104
publish-nuget:
102105
runs-on: ubuntu-latest
@@ -105,7 +108,7 @@ jobs:
105108
steps:
106109
- uses: actions/checkout@v4
107110
with:
108-
ref: v${{ needs.version.outputs.version }}
111+
ref: ${{ needs.version.outputs.sha }}
109112

110113
- name: Setup .NET
111114
uses: actions/setup-dotnet@v4
@@ -135,7 +138,7 @@ jobs:
135138
steps:
136139
- uses: actions/checkout@v4
137140
with:
138-
ref: v${{ needs.version.outputs.version }}
141+
ref: ${{ needs.version.outputs.sha }}
139142

140143
- name: Setup Node.js
141144
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)