@@ -2,6 +2,9 @@ name: Release
22
33on :
44 workflow_dispatch :
5+ push :
6+ branches :
7+ - master
58
69permissions :
710 contents : write
2023 with :
2124 fetch-depth : 0
2225
26+ - name : Resolve release commit
27+ shell : pwsh
28+ run : |
29+ if ('${{ github.event_name }}' -eq 'push') {
30+ $releaseSha = (git rev-parse HEAD^).Trim()
31+ } else {
32+ $releaseSha = (git rev-parse HEAD).Trim()
33+ }
34+ "RELEASE_SHA=$releaseSha" >> $env:GITHUB_ENV
35+ Write-Host "Release commit: $releaseSha"
36+
2337 - name : Verify release state
2438 shell : pwsh
2539 env :
5064 throw 'Release blocked by open pull requests targeting master.'
5165 }
5266
67+ - name : Checkout release commit
68+ shell : pwsh
69+ run : git checkout --detach $env:RELEASE_SHA
70+
5371 - name : Install Rust stable
5472 uses : dtolnay/rust-toolchain@stable
5573 with :
@@ -114,14 +132,14 @@ jobs:
114132 git rev-parse $env:TAG 2>$null
115133 if ($LASTEXITCODE -eq 0) {
116134 $tagCommit = (git rev-list -n 1 $env:TAG).Trim()
117- if ($tagCommit -ne $env:GITHUB_SHA ) {
135+ if ($tagCommit -ne $env:RELEASE_SHA ) {
118136 throw "$env:TAG already exists on a different commit."
119137 }
120138 Write-Host "$env:TAG already exists on this commit."
121139 } else {
122140 git config user.name "github-actions[bot]"
123141 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
124- git tag -a $env:TAG -m "Compactor $env:TAG"
142+ git tag -a $env:TAG $env:RELEASE_SHA -m "Compactor $env:TAG"
125143 git push origin $env:TAG
126144 }
127145
0 commit comments