@@ -8,11 +8,14 @@ permissions:
88 contents : write
99
1010jobs :
11- auto-release :
12- name : Determine Version and Tag
11+ version :
12+ name : Determine Version
1313 runs-on : ubuntu-latest
1414 # Skip version bump commits to avoid infinite loops
1515 if : " !startsWith(github.event.head_commit.message, 'chore(release):')"
16+ outputs :
17+ tag : ${{ steps.version.outputs.next }}
18+ version : ${{ steps.version.outputs.version }}
1619
1720 steps :
1821 - uses : actions/checkout@v4
3336 latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
3437 echo "latest=$latest_tag" >> "$GITHUB_OUTPUT"
3538
36- # Parse current version
3739 version="${latest_tag#v}"
3840 IFS='.' read -r major minor patch <<< "$version"
3941
40- # Check commit messages since last tag for bump type
4142 commits=$(git log "$latest_tag"..HEAD --pretty=format:"%s" 2>/dev/null || git log --pretty=format:"%s")
4243
4344 if echo "$commits" | grep -qE "^feat(\(.+\))?!:|^fix(\(.+\))?!:|^refactor(\(.+\))?!:|BREAKING CHANGE"; then
7778 git commit -m "chore(release): bump version to v$VERSION"
7879 git tag -a "$TAG" -m "Release $TAG"
7980 git push origin main --follow-tags
81+
82+ build :
83+ name : Build ${{ matrix.target }}
84+ needs : version
85+ runs-on : ${{ matrix.os }}
86+ strategy :
87+ fail-fast : false
88+ matrix :
89+ include :
90+ - target : linux-x64
91+ os : ubuntu-latest
92+ artifact : upkeep-linux-x64
93+ - target : darwin-arm64
94+ os : macos-latest
95+ artifact : upkeep-darwin-arm64
96+ - target : darwin-x64
97+ os : macos-latest
98+ artifact : upkeep-darwin-x64
99+ - target : windows-x64
100+ os : windows-latest
101+ artifact : upkeep-windows-x64.exe
102+
103+ steps :
104+ - name : Checkout
105+ uses : actions/checkout@v4
106+ with :
107+ ref : ${{ needs.version.outputs.tag }}
108+
109+ - name : Setup Bun
110+ uses : oven-sh/setup-bun@v2
111+ with :
112+ bun-version : latest
113+
114+ - name : Install dependencies
115+ run : bun install --frozen-lockfile
116+
117+ - name : Build binary
118+ run : bun run build:${{ matrix.target }}
119+
120+ - name : Upload artifact
121+ uses : actions/upload-artifact@v4
122+ with :
123+ name : ${{ matrix.artifact }}
124+ path : dist/${{ matrix.artifact }}
125+ if-no-files-found : error
126+
127+ release :
128+ name : Create Release
129+ needs : [version, build]
130+ runs-on : ubuntu-latest
131+
132+ steps :
133+ - name : Checkout
134+ uses : actions/checkout@v4
135+ with :
136+ ref : ${{ needs.version.outputs.tag }}
137+ fetch-depth : 0
138+
139+ - name : Download all artifacts
140+ uses : actions/download-artifact@v4
141+ with :
142+ path : artifacts
143+
144+ - name : Prepare release files
145+ run : |
146+ mkdir -p release
147+ cp artifacts/upkeep-linux-x64/upkeep-linux-x64 release/
148+ cp artifacts/upkeep-darwin-arm64/upkeep-darwin-arm64 release/
149+ cp artifacts/upkeep-darwin-x64/upkeep-darwin-x64 release/
150+ cp artifacts/upkeep-windows-x64.exe/upkeep-windows-x64.exe release/
151+ chmod +x release/upkeep-linux-x64
152+ chmod +x release/upkeep-darwin-arm64
153+ chmod +x release/upkeep-darwin-x64
154+ ls -la release/
155+
156+ - name : Generate changelog
157+ uses : orhun/git-cliff-action@v4
158+ id : changelog
159+ with :
160+ config : cliff.toml
161+ args : --latest --strip header
162+ env :
163+ OUTPUT : CHANGELOG.md
164+
165+ - name : Create GitHub Release
166+ uses : softprops/action-gh-release@v2
167+ with :
168+ tag_name : ${{ needs.version.outputs.tag }}
169+ files : |
170+ release/upkeep-linux-x64
171+ release/upkeep-darwin-arm64
172+ release/upkeep-darwin-x64
173+ release/upkeep-windows-x64.exe
174+ body : ${{ steps.changelog.outputs.content }}
175+ draft : false
176+ prerelease : false
0 commit comments