-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (74 loc) · 2.74 KB
/
release.yml
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
# Based on https://github.com/typst/typst/blob/main/.github/workflows/release.yml
name: Build Release Binaries
on:
release:
types: [published]
jobs:
build-release:
name: release ${{ matrix.target }}
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: x86_64-pc-windows-msvc
os: windows-latest
cross: false
- target: x86_64-apple-darwin
os: macos-latest
cross: false
- target: aarch64-apple-darwin
os: macos-latest
cross: false
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v1
- name: Build linux binaries
if: ${{ matrix.cross }}
run: |
cargo install cargo-zigbuild
rustup target add ${{ matrix.target }}
cargo zigbuild -p filterx --release --target ${{ matrix.target }}.2.17
mkdir -p target/${{ matrix.target }}.2.17/release
cp target/${{ matrix.target }}/release/filterx target/${{ matrix.target }}.2.17/release/filterx
cargo zigbuild -p filterx --release --target ${{ matrix.target }}
- name: Build windows/mac binaries
if: ${{ !matrix.cross }}
run: |
rustup target add ${{ matrix.target }}
cargo build -p filterx --release --target ${{ matrix.target }}
- name: create artifact directory
shell: bash
run: |
echo "target: ${{ matrix.target }}"
directory=filterx-${{ matrix.target }}
mkdir $directory
if [ -f target/${{ matrix.target }}/release/filterx ]; then
cp target/${{ matrix.target }}/release/filterx $directory/
tar cJf $directory.tar.xz $directory/
echo "artifact: $directory.tar.xz"
if [ -f target/${{ matrix.target }}.2.17/release/filterx ]; then
mkdir $directory.2.17
cp target/${{ matrix.target }}.2.17/release/filterx $directory.2.17/
tar cJf $directory.2.17.tar.xz $directory.2.17/
echo "artifact: $directory.2.17.tar.xz"
fi
fi
if [ -f target/${{ matrix.target }}/release/filterx.exe ]; then
cp target/${{ matrix.target }}/release/filterx.exe $directory/
7z a $directory.zip $directory/
echo "artifact: $directory.zip"
fi
- uses: ncipollo/release-action@v1.14.0
with:
artifacts: "*.tar.xz,*.zip"
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true