Skip to content

Commit ac756b9

Browse files
committed
Build release binaries in CI
1 parent c5736c4 commit ac756b9

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

.github/workflows/release.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,56 @@ permissions:
99
contents: write
1010

1111
jobs:
12+
build-binaries:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- os: ubuntu-latest
19+
target: x86_64-unknown-linux-gnu
20+
ext: ""
21+
archive: tar.gz
22+
- os: windows-latest
23+
target: x86_64-pc-windows-msvc
24+
ext: ".exe"
25+
archive: zip
26+
- os: macos-13
27+
target: x86_64-apple-darwin
28+
ext: ""
29+
archive: tar.gz
30+
- os: macos-14
31+
target: aarch64-apple-darwin
32+
ext: ""
33+
archive: tar.gz
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: dtolnay/rust-toolchain@stable
37+
with:
38+
targets: ${{ matrix.target }}
39+
- uses: Swatinem/rust-cache@v2
40+
- name: cargo build
41+
run: cargo build --release --target ${{ matrix.target }}
42+
- name: package
43+
shell: bash
44+
run: |
45+
set -euo pipefail
46+
bin="cipherscope${{ matrix.ext }}"
47+
src="target/${{ matrix.target }}/release/${bin}"
48+
dist="dist"
49+
mkdir -p "${dist}"
50+
if [[ "${{ matrix.archive }}" == "zip" ]]; then
51+
7z a "${dist}/cipherscope-${{ github.ref_name }}-${{ matrix.target }}.zip" "${src}"
52+
else
53+
tar -czf "${dist}/cipherscope-${{ github.ref_name }}-${{ matrix.target }}.tar.gz" -C "target/${{ matrix.target }}/release" "${bin}"
54+
fi
55+
- name: upload release assets
56+
uses: softprops/action-gh-release@v2
57+
with:
58+
files: dist/*
59+
1260
publish:
61+
needs: build-binaries
1362
runs-on: ubuntu-latest
1463
steps:
1564
- uses: actions/checkout@v4
@@ -23,4 +72,3 @@ jobs:
2372
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
2473
- name: GitHub Release
2574
uses: softprops/action-gh-release@v2
26-

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)