Skip to content

Commit a972b52

Browse files
committed
can we get multi arch release CLI binaries?
1 parent e8f1c18 commit a972b52

File tree

1 file changed

+72
-1
lines changed

1 file changed

+72
-1
lines changed

.github/workflows/main.yaml

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ on:
99
env:
1010
CARGO_TERM_COLOR: always
1111
REGISTRY: ghcr.io
12-
IMAGE_NAME: joostvdg/git-next-tag-rust
12+
IMAGE_NAME: joostvdg/git-next-tag-rustasd
13+
1314

1415
jobs:
1516
test:
@@ -158,6 +159,43 @@ jobs:
158159
echo "patch=$PATCH" >> $GITHUB_OUTPUT
159160
echo "Generated version: $NEW_VERSION"
160161
162+
build-artifacts:
163+
runs-on: ubuntu-latest
164+
needs: [generate-version]
165+
outputs:
166+
version: ${{ needs.generate-version.outputs.version }}
167+
steps:
168+
- uses: actions/checkout@v4
169+
with:
170+
fetch-depth: 0
171+
172+
- name: Install cross
173+
run: cargo install cross
174+
175+
- name: Build Linux AMD64
176+
run: cross build --release --target x86_64-unknown-linux-gnu
177+
178+
- name: Build Windows AMD64
179+
run: cross build --release --target x86_64-pc-windows-gnu
180+
181+
- name: Build Mac ARM64
182+
run: cross build --release --target aarch64-apple-darwin
183+
184+
- name: Prepare artifacts
185+
run: |
186+
mkdir -p dist
187+
cp target/x86_64-unknown-linux-gnu/release/git-next-tag-rust dist/git-next-tag-rust-linux-amd64
188+
cp target/x86_64-pc-windows-gnu/release/git-next-tag-rust.exe dist/git-next-tag-rust-windows-amd64.exe
189+
cp target/aarch64-apple-darwin/release/git-next-tag-rust dist/git-next-tag-rust-macos-arm64
190+
cd dist
191+
sha256sum * > checksums.txt
192+
193+
- name: Upload build artifacts
194+
uses: actions/upload-artifact@v4
195+
with:
196+
name: cli-binaries
197+
path: dist/
198+
161199
build-and-push:
162200
needs: [scans, test, security-scan, generate-version]
163201
runs-on: ubuntu-latest
@@ -280,3 +318,36 @@ jobs:
280318
draft: false
281319
prerelease: false
282320

321+
- name: Download build artifacts
322+
uses: actions/download-artifact@v4
323+
with:
324+
name: cli-binaries
325+
path: dist/
326+
327+
- name: Create GitHub release
328+
uses: actions/create-release@v1
329+
env:
330+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
331+
with:
332+
tag_name: v${{ needs.generate-version.outputs.version }}
333+
release_name: Release v${{ needs.generate-version.outputs.version }}
334+
body: |
335+
## Changes
336+
- Automated release v${{ needs.generate-version.outputs.version }}
337+
338+
## Container Image
339+
- `${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.generate-version.outputs.version }}`
340+
- `${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build-and-push.outputs.image-digest }}`
341+
342+
draft: false
343+
prerelease: false
344+
345+
- name: Upload release assets
346+
uses: softprops/action-gh-release@v1
347+
with:
348+
tag_name: v${{ needs.generate-version.outputs.version }}
349+
files: |
350+
dist/git-next-tag-rust-linux-amd64
351+
dist/git-next-tag-rust-windows-amd64.exe
352+
dist/git-next-tag-rust-macos-arm64
353+
dist/checksums.txt

0 commit comments

Comments
 (0)