Skip to content

Commit fa00892

Browse files
nsheapsclaude
andauthored
fix: improve release workflow and changelog generation (#4)
- Keep __VERSION__ placeholder in source, embed version only in release asset - Switch homebrew formula to use release asset URL instead of archive tarball - Add retry logic for release asset download (CDN propagation) - Include commits from merged branches in changelog (firstParent: false) Co-authored-by: Claude Code (User Settings, in: ${CLAUDE_PROJECT_DIR}) <noreply@anthropic.com>
1 parent a181493 commit fa00892

3 files changed

Lines changed: 32 additions & 18 deletions

File tree

.github/workflows/release.yaml

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,12 @@ 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 "s/__VERSION__/${{ steps.next-version.outputs.tag }}/" bin/git-wt
60-
6155
- name: Run release-it
6256
id: release
6357
if: steps.next-version.outputs.will-release == 'true'
6458
run: |
6559
# Run release-it to bump version, update changelog, commit, and tag
66-
# The version-embedded script will be included in the commit
60+
# Source keeps __VERSION__ placeholder - version embedded only in release asset
6761
if yarn release-it --ci; then
6862
echo "released=true" >> "$GITHUB_OUTPUT"
6963
echo "version=${{ steps.next-version.outputs.version }}" >> "$GITHUB_OUTPUT"
@@ -76,8 +70,11 @@ jobs:
7670
- name: Create GitHub release
7771
if: steps.release.outputs.released == 'true'
7872
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
7976
gh release create "${{ steps.release.outputs.tag }}" \
80-
bin/git-wt \
77+
/tmp/git-wt#git-wt \
8178
--title "${{ steps.release.outputs.tag }}" \
8279
--generate-notes
8380
@@ -109,12 +106,22 @@ jobs:
109106
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
110107
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
111108
112-
# Download source tarball and calculate SHA256
113-
TARBALL_URL="https://github.com/${{ github.repository }}/archive/refs/tags/${TAG}.tar.gz"
114-
echo "Downloading tarball from: $TARBALL_URL"
115-
SHA256=$(curl -sL "$TARBALL_URL" | shasum -a 256 | cut -d' ' -f1)
116-
echo "sha256=$SHA256" >> "$GITHUB_OUTPUT"
117-
echo "Successfully got SHA256: $SHA256"
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
118125
119126
- name: Clone homebrew-devsetup
120127
run: |
@@ -130,7 +137,7 @@ jobs:
130137
class GitWt < Formula
131138
desc 'Interactive TUI for git worktree management'
132139
homepage 'https://github.com/nsheaps/git-wt'
133-
url 'https://github.com/nsheaps/git-wt/archive/refs/tags/${{ steps.release.outputs.tag }}.tar.gz'
140+
url 'https://github.com/nsheaps/git-wt/releases/download/${{ steps.release.outputs.tag }}/git-wt'
134141
sha256 '${{ steps.release.outputs.sha256 }}'
135142
license 'MIT'
136143
@@ -141,7 +148,11 @@ jobs:
141148
depends_on 'gum'
142149
143150
def install
144-
bin.install 'bin/git-wt'
151+
if build.head?
152+
bin.install 'bin/git-wt'
153+
else
154+
bin.install 'git-wt'
155+
end
145156
end
146157
147158
test do

.release-it.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
]
2525
},
2626
"infile": "CHANGELOG.md",
27-
"header": "# Changelog"
27+
"header": "# Changelog",
28+
"gitRawCommitsOpts": {
29+
"firstParent": false
30+
}
2831
}
2932
}
3033
}

bin/git-wt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
set -euo pipefail
2121

2222
# Version is replaced at release time by CI. For local dev, falls back to git describe.
23-
GIT_WT_VERSION="v0.4.5"
23+
GIT_WT_VERSION="__VERSION__"
2424

2525
# Get version: use embedded version if set, otherwise fall back to git describe for local dev
2626
get_version() {

0 commit comments

Comments
 (0)