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