-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (79 loc) · 2.72 KB
/
cd.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
82
83
name: Continous Delivery
on:
release:
types: [created]
permissions:
contents: write
env:
ZIG_VERSION: 0.13.0
jobs:
release:
name: Release - ${{ matrix.platform.release_for }}
strategy:
fail-fast: false
matrix:
platform:
- release_for: macOS-aarch64
os: macOS-latest
target: aarch64-apple-darwin
zig_target: aarch64-macos-none
rust_bin: create-docx
zig_bin: pfcreator
name: pfcreator-darwin-aarch64
command: build
- release_for: macOS-x86_64
os: macOS-latest
target: x86_64-apple-darwin
zig_target: x86_64-macos-none
rust_bin: create-docx
zig_bin: pfcreator
name: pfcreator-darwin-x86_64
command: build
- release_for: Linux-x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
zig_target: x86_64-linux-gnu
rust_bin: create-docx
zig_bin: pfcreator
name: pfcreator-linux-x86_64
command: build
- release_for: Linux-aarch64-gnu
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
zig_target: aarch64-linux-gnu
rust_bin: create-docx
zig_bin: pfcreator
name: pfcreator-linux-aarch64
command: build
runs-on: ${{ matrix.platform.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: ${{ env.ZIG_VERSION }}
- name: Build Zig Binary
run: |
zig build -Doptimize=ReleaseSafe -Dtarget=${{ matrix.platform.zig_target }}
mkdir -p zig-bins
cp zig-out/bin/${{ matrix.platform.zig_bin }} zig-bins/${{ matrix.platform.zig_bin }}
- name: Build Rust Binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: ${{ matrix.platform.command }}
target: ${{ matrix.platform.target }}
args: "--locked --release"
strip: true
- name: Package and Upload
shell: bash
run: |
mkdir -p ${{ matrix.platform.name }}
# Copy Rust binary
cp target/${{ matrix.platform.target }}/release/${{ matrix.platform.rust_bin }} ${{ matrix.platform.name }}
# Copy Zig binary from our temporary location
cp zig-bins/${{ matrix.platform.zig_bin }} ${{ matrix.platform.name }}
tar -czf ${{ matrix.platform.name }}.tar.gz ${{ matrix.platform.name }}
gh release upload ${{ github.event.release.tag_name }} ${{ matrix.platform.name }}.tar.gz
env:
GH_TOKEN: ${{ github.token }}