-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (88 loc) · 2.82 KB
/
Copy pathrelease.yml
File metadata and controls
88 lines (88 loc) · 2.82 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-pc-windows-gnu
os: ubuntu-latest
- target: aarch64-pc-windows-gnullvm
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: goto-bus-stop/setup-zig@v2
if: runner.os != 'macOS'
with:
zig-version: master
- uses: actions/cache@v5
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-
- name: Install cargo-zigbuild
if: runner.os != 'macOS'
run: cargo install cargo-zigbuild --force
- name: Build (cross)
if: runner.os != 'macOS'
run: cargo zigbuild --release --locked --target ${{ matrix.target }}
- name: Build (native)
if: runner.os == 'macOS'
run: cargo build --release --locked --target ${{ matrix.target }}
- name: Copy binary (Unix)
if: "!contains(matrix.target, 'windows')"
run: cp target/${{ matrix.target }}/release/gitkeep gitkeep-${{ matrix.target }}
- name: Copy binary (Windows)
if: contains(matrix.target, 'windows')
run: cp target/${{ matrix.target }}/release/gitkeep.exe gitkeep-${{ matrix.target }}.exe
- name: Upload artifact (Unix)
if: "!contains(matrix.target, 'windows')"
uses: actions/upload-artifact@v7
with:
name: gitkeep-${{ matrix.target }}
path: gitkeep-${{ matrix.target }}
- name: Upload artifact (Windows)
if: contains(matrix.target, 'windows')
uses: actions/upload-artifact@v7
with:
name: gitkeep-${{ matrix.target }}
path: gitkeep-${{ matrix.target }}.exe
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
path: artifacts/
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v3
with:
files: artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}