1+ name : Release
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*.*.*'
7+ workflow_dispatch :
8+ inputs :
9+ version :
10+ description : ' Version to release (e.g., v1.2.3)'
11+ required : true
12+ type : string
13+ prerelease :
14+ description : ' Mark as pre-release'
15+ required : false
16+ type : boolean
17+ default : false
18+
19+ permissions :
20+ contents : write
21+ actions : read
22+
23+ jobs :
24+ build :
25+ name : Build Cross-Platform Binaries
26+ runs-on : ubuntu-latest
27+
28+ steps :
29+ - name : Checkout code
30+ uses : actions/checkout@v4
31+
32+ - name : Install devbox
33+ uses : jetify-com/devbox-install-action@v0.12.0
34+ with :
35+ enable-cache : true
36+
37+ - name : Run quality checks
38+ run : |
39+ devbox run lint
40+ devbox run type-check
41+ devbox run test
42+
43+ - name : Create dist directory
44+ run : mkdir -p dist
45+
46+ - name : Build all platforms
47+ run : devbox run build:all
48+
49+ - name : Generate checksums
50+ run : |
51+ cd dist
52+ sha256sum wt-* > checksums.txt
53+
54+ - name : Upload build artifacts
55+ uses : actions/upload-artifact@v4
56+ with :
57+ name : binaries
58+ path : |
59+ dist/wt-*
60+ dist/checksums.txt
61+
62+ release :
63+ name : Create GitHub Release
64+ needs : build
65+ runs-on : ubuntu-latest
66+
67+ steps :
68+ - name : Checkout code
69+ uses : actions/checkout@v4
70+
71+ - name : Download build artifacts
72+ uses : actions/download-artifact@v4
73+ with :
74+ name : binaries
75+ path : dist/
76+
77+ - name : Determine version
78+ id : version
79+ run : |
80+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
81+ echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
82+ echo "prerelease=${{ github.event.inputs.prerelease }}" >> $GITHUB_OUTPUT
83+ else
84+ echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
85+ echo "prerelease=false" >> $GITHUB_OUTPUT
86+ fi
87+
88+ - name : Create release archives
89+ run : |
90+ cd dist
91+ for binary in wt-linux-x64 wt-linux-arm64 wt-darwin-x64 wt-darwin-arm64; do
92+ if [ -f "$binary" ]; then
93+ if [[ "$binary" == *"darwin"* ]]; then
94+ zip "${binary}.zip" "$binary"
95+ else
96+ tar -czf "${binary}.tar.gz" "$binary"
97+ fi
98+ fi
99+ done
100+
101+ - name : Generate release notes
102+ id : release_notes
103+ run : |
104+ echo "## What's Changed" > release_notes.md
105+ echo "" >> release_notes.md
106+ echo "### Binaries" >> release_notes.md
107+ echo "" >> release_notes.md
108+ echo "| Platform | Architecture | Download |" >> release_notes.md
109+ echo "|----------|-------------|----------|" >> release_notes.md
110+ echo "| Linux | x64 | [wt-linux-x64.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.version }}/wt-linux-x64.tar.gz) |" >> release_notes.md
111+ echo "| Linux | ARM64 | [wt-linux-arm64.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.version }}/wt-linux-arm64.tar.gz) |" >> release_notes.md
112+ echo "| macOS | x64 (Intel) | [wt-darwin-x64.zip](https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.version }}/wt-darwin-x64.zip) |" >> release_notes.md
113+ echo "| macOS | ARM64 (Apple Silicon) | [wt-darwin-arm64.zip](https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.version }}/wt-darwin-arm64.zip) |" >> release_notes.md
114+ echo "" >> release_notes.md
115+ echo "### Installation" >> release_notes.md
116+ echo "" >> release_notes.md
117+ echo '```bash' >> release_notes.md
118+ echo "# Quick install (latest version)" >> release_notes.md
119+ echo "curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/main/install.sh | sh" >> release_notes.md
120+ echo "" >> release_notes.md
121+ echo "# Install specific version" >> release_notes.md
122+ echo "WT_INSTALL_VERSION=${{ steps.version.outputs.version }} curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/main/install.sh | sh" >> release_notes.md
123+ echo '```' >> release_notes.md
124+ echo "" >> release_notes.md
125+ echo "### Verification" >> release_notes.md
126+ echo "" >> release_notes.md
127+ echo "All binaries include SHA256 checksums for verification. Download [checksums.txt](https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.version }}/checksums.txt) to verify your download." >> release_notes.md
128+
129+ - name : Create GitHub Release
130+ uses : softprops/action-gh-release@v2
131+ with :
132+ tag_name : ${{ steps.version.outputs.version }}
133+ name : Release ${{ steps.version.outputs.version }}
134+ body_path : release_notes.md
135+ prerelease : ${{ steps.version.outputs.prerelease }}
136+ files : |
137+ dist/wt-*.tar.gz
138+ dist/wt-*.zip
139+ dist/checksums.txt
140+ generate_release_notes : true
0 commit comments