Skip to content

Commit 32ca563

Browse files
committed
Merge branch 'main' into 'improve-error-ranges-2'
2 parents 63446a9 + fb972d4 commit 32ca563

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

.github/workflows/release.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Release
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
build:
8+
name: Build and Upload
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
include:
13+
- os: ubuntu-latest
14+
- os: macos-latest
15+
- os: windows-latest
16+
17+
steps:
18+
- name: Clone project
19+
uses: actions/checkout@v3
20+
21+
- name: Validate toolchain
22+
shell: bash
23+
run: |
24+
echo "RUST_VERSION=$(rustc --version | cut -d ' ' -f 2)" >> ${GITHUB_ENV}
25+
26+
- uses: actions/cache@v4
27+
with:
28+
path: |
29+
~/.cargo/bin/
30+
~/.cargo/registry/index/
31+
~/.cargo/registry/cache/
32+
~/.cargo/git/db/
33+
target/release
34+
key: cargo-${{ runner.os }}-${{ runner.arch}}-${{ env.RUST_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
35+
restore-keys: |
36+
cargo-${{ runner.os }}-${{ runner.arch}}-${{ env.RUST_VERSION }}-
37+
38+
- name: Build binary
39+
run: |
40+
cargo build --release
41+
42+
- name: Prepare target name
43+
id: prepare
44+
shell: bash
45+
run: |
46+
case "${{ runner.os }}" in
47+
Linux)
48+
OS="linux"
49+
;;
50+
macOS)
51+
OS="darwin"
52+
;;
53+
Windows)
54+
OS="windows"
55+
;;
56+
esac
57+
58+
case "${{ runner.arch }}" in
59+
ARM)
60+
ARCH="arm"
61+
;;
62+
ARM64)
63+
ARCH="aarch64"
64+
;;
65+
X64)
66+
ARCH="x86_64"
67+
;;
68+
X86)
69+
ARCH="i686"
70+
;;
71+
*)
72+
ARCH="${{ runner.arch }}"
73+
;;
74+
esac
75+
76+
case "${{ runner.os }}" in
77+
Linux)
78+
TARGET="technique-${{ github.ref_name }}-${OS}-${ARCH}.gz"
79+
;;
80+
macOS)
81+
TARGET="technique-${{ github.ref_name }}-${OS}-${ARCH}.gz"
82+
;;
83+
Windows)
84+
TARGET="technique-${{ github.ref_name }}-${OS}-${ARCH}.zip"
85+
;;
86+
esac
87+
88+
echo "target=${TARGET}" >> $GITHUB_OUTPUT
89+
90+
- name: Compress binary (Unix)
91+
if: runner.os != 'Windows'
92+
run: |
93+
gzip -c target/release/technique > ${{ steps.prepare.outputs.target }}
94+
95+
- name: Compress binary (Windows)
96+
if: runner.os == 'Windows'
97+
shell: pwsh
98+
run: |
99+
Compress-Archive -Path target/release/technique.exe -DestinationPath ${{ steps.prepare.outputs.target }}
100+
101+
- name: Upload binary to Release
102+
uses: softprops/action-gh-release@v2
103+
with:
104+
tag_name: ${{ github.ref_name }}
105+
files: ${{ steps.prepare.outputs.target }}

0 commit comments

Comments
 (0)