@@ -52,12 +52,18 @@ jobs:
5252 echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
5353 fi
5454
55+ - name : Embed version in script
56+ if : steps.next-version.outputs.will-release == 'true'
57+ run : |
58+ # Embed version before release-it commits, so the tagged commit has it
59+ sed -i -E 's/GIT_WT_VERSION="(__VERSION__|v[0-9]+\.[0-9]+\.[0-9]+)"/GIT_WT_VERSION="${{ steps.next-version.outputs.tag }}"/' bin/git-wt
60+
5561 - name : Run release-it
5662 id : release
5763 if : steps.next-version.outputs.will-release == 'true'
5864 run : |
5965 # Run release-it to bump version, update changelog, commit, and tag
60- # Source keeps __VERSION__ placeholder - version embedded only in release asset
66+ # The embedded version will be included in the tagged commit
6167 if yarn release-it --ci; then
6268 echo "released=true" >> "$GITHUB_OUTPUT"
6369 echo "version=${{ steps.next-version.outputs.version }}" >> "$GITHUB_OUTPUT"
@@ -70,14 +76,21 @@ jobs:
7076 - name : Create GitHub release
7177 if : steps.release.outputs.released == 'true'
7278 run : |
73- # Create versioned copy for release asset (source keeps __VERSION__)
74- cp bin/git-wt /tmp/git-wt
75- sed -i 's/__VERSION__/${{ steps.release.outputs.tag }}/' /tmp/git-wt
79+ # Upload bin/git-wt which still has the embedded version
7680 gh release create "${{ steps.release.outputs.tag }}" \
77- /tmp/git-wt# git-wt \
81+ bin/ git-wt \
7882 --title "${{ steps.release.outputs.tag }}" \
7983 --generate-notes
8084
85+ - name : Reset version to placeholder
86+ if : steps.release.outputs.released == 'true'
87+ run : |
88+ # Reset to __VERSION__ so main branch stays clean
89+ sed -i -E 's/GIT_WT_VERSION="v[0-9]+\.[0-9]+\.[0-9]+"/GIT_WT_VERSION="__VERSION__"/' bin/git-wt
90+ git add bin/git-wt
91+ git commit -m "chore: reset version placeholder [skip ci]"
92+ git push
93+
8194 update-homebrew :
8295 if : needs.release.outputs.released == 'true'
8396 needs : release
@@ -106,22 +119,14 @@ jobs:
106119 echo "version=$VERSION" >> "$GITHUB_OUTPUT"
107120 echo "tag=$TAG" >> "$GITHUB_OUTPUT"
108121
109- # Download release asset and calculate SHA256
110- ASSET_URL="https://github.com/${{ github.repository }}/releases/download/${TAG}/git-wt"
111- echo "Downloading release asset from: $ASSET_URL"
112- # Retry a few times in case of CDN propagation delay
113- for i in {1..5}; do
114- if curl -fsSL "$ASSET_URL" -o /tmp/git-wt; then
115- SHA256=$(shasum -a 256 /tmp/git-wt | cut -d' ' -f1)
116- echo "sha256=$SHA256" >> "$GITHUB_OUTPUT"
117- echo "Successfully got SHA256: $SHA256"
118- exit 0
119- fi
120- echo "Attempt $i failed, retrying in 5s..."
121- sleep 5
122- done
123- echo "Failed to download release asset"
124- exit 1
122+ # Download archive tarball and calculate SHA256
123+ # Archive is available instantly (no CDN delay like release assets)
124+ TARBALL_URL="https://github.com/${{ github.repository }}/archive/refs/tags/${TAG}.tar.gz"
125+ echo "Downloading tarball from: $TARBALL_URL"
126+ curl -fsSL "$TARBALL_URL" -o /tmp/archive.tar.gz
127+ SHA256=$(shasum -a 256 /tmp/archive.tar.gz | cut -d' ' -f1)
128+ echo "sha256=$SHA256" >> "$GITHUB_OUTPUT"
129+ echo "Successfully got SHA256: $SHA256"
125130
126131 - name : Clone homebrew-devsetup
127132 run : |
@@ -137,7 +142,7 @@ jobs:
137142 class GitWt < Formula
138143 desc 'Interactive TUI for git worktree management'
139144 homepage 'https://github.com/nsheaps/git-wt'
140- url 'https://github.com/nsheaps/git-wt/releases/download/ ${{ steps.release.outputs.tag }}/git-wt '
145+ url 'https://github.com/nsheaps/git-wt/archive/refs/tags/ ${{ steps.release.outputs.tag }}.tar.gz '
141146 sha256 '${{ steps.release.outputs.sha256 }}'
142147 license 'MIT'
143148
@@ -148,11 +153,7 @@ jobs:
148153 depends_on 'gum'
149154
150155 def install
151- if build.head?
152- bin.install 'bin/git-wt'
153- else
154- bin.install 'git-wt'
155- end
156+ bin.install 'bin/git-wt'
156157 end
157158
158159 test do
0 commit comments