Skip to content

Commit c841180

Browse files
committed
Build and compress release artifact for MacOS and Windows
1 parent 4550155 commit c841180

File tree

1 file changed

+48
-12
lines changed

1 file changed

+48
-12
lines changed

.github/workflows/release.yaml

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ on:
66
jobs:
77
build:
88
name: Build and Upload
9-
runs-on: ubuntu-latest
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
include:
13+
- os: ubuntu-latest
14+
- os: macos-latest
15+
- os: windows-latest
16+
1017
steps:
1118
- name: Clone project
1219
uses: actions/checkout@v3
@@ -31,39 +38,68 @@ jobs:
3138
run: |
3239
cargo build --release
3340
34-
- name: Prepare binary
41+
- name: Prepare target name
3542
id: prepare
3643
run: |
3744
case "${{ runner.os }}" in
3845
Linux)
3946
OS="linux"
4047
;;
41-
Windows)
42-
OS="windows"
43-
;;
4448
macOS)
45-
OS="macos"
49+
OS="darwin"
4650
;;
47-
*)
48-
OS="${{ runner.os }}"
51+
Windows)
52+
OS="windows"
4953
;;
5054
esac
5155
5256
case "${{ runner.arch }}" in
57+
ARM)
58+
ARCH="arm"
59+
;;
60+
ARM64)
61+
ARCH="aarch64"
62+
;;
5363
X64)
5464
ARCH="x86_64"
5565
;;
66+
X86)
67+
ARCH="i686"
68+
;;
5669
*)
5770
ARCH="${{ runner.arch }}"
5871
;;
5972
esac
6073
61-
TARGET="technique-${{ github.ref_name }}-${OS}-${ARCH}.gz"
62-
gzip -c target/release/technique > ${TARGET}
63-
echo "binary=${TARGET}" >> $GITHUB_OUTPUT
74+
case "${{ runner.os }}" in
75+
Linux)
76+
TARGET="technique-${{ github.ref_name }}-${OS}-${ARCH}.gz"
77+
;;
78+
macOS)
79+
TARGET="technique-${{ github.ref_name }}-${OS}-${ARCH}.gz"
80+
;;
81+
Windows)
82+
TARGET="technique-${{ github.ref_name }}-${OS}-${ARCH}.zip"
83+
;;
84+
esac
85+
86+
echo "target=${TARGET}" >> $GITHUB_OUTPUT
87+
88+
- name: Compress binary (Unix)
89+
id: compress
90+
if: runner.os != 'Windows'
91+
run: |
92+
gzip -c target/release/technique > ${{ steps.prepare.outputs.target }}
93+
94+
- name: Compress binary (Windows)
95+
id: compress
96+
if: runner.os == 'Windows'
97+
shell: pwsh
98+
run: |
99+
Compress-Archive -Path target/release/technique.exe -DestinationPath ${{ steps.prepare.outputs.target }}
64100
65101
- name: Upload binary to Release
66102
uses: softprops/action-gh-release@v2
67103
with:
68104
tag_name: ${{ github.ref_name }}
69-
files: ${{ steps.prepare.outputs.binary }}
105+
files: ${{ steps.prepare.outputs.target }}

0 commit comments

Comments
 (0)