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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build-and-release:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
name: cx-linux
# Windows
- os: windows-latest
target: x86_64-pc-windows-msvc
name: cx-windows.exe
# macOS (Apple Silicon - M1/M2)
- os: macos-latest
target: aarch64-apple-darwin
name: cx-macos-arm64
# macOS (Intel)
- os: macos-15
target: x86_64-apple-darwin
name: cx-macos-intel
steps:
- uses: actions/checkout@v6
- name: Install Perl (Windows only)
if: matrix.os == 'windows-latest'
uses: shogo82148/actions-setup-perl@v1
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Cargo Registry & Target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo-
- name: Build Binary
run: cargo build --release --target ${{ matrix.target }} --locked
- name: Prepare Artifact (Unix)
if: matrix.os != 'windows-latest'
run: |
mv target/${{ matrix.target }}/release/cx target/${{ matrix.target }}/release/${{ matrix.name }}
- name: Prepare Artifact (Windows)
if: matrix.os == 'windows-latest'
run: |
Move-Item -Force target/${{ matrix.target }}/release/cx.exe target/${{ matrix.target }}/release/${{ matrix.name }}
- name: Upload Artifact
uses: actions/upload-artifact@v5
with:
name: ${{ matrix.name }}
path: target/${{ matrix.target }}/release/${{ matrix.name }}
publish:
needs: build-and-release
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v6
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/cx-linux/cx-linux
artifacts/cx-windows.exe/cx-windows.exe
artifacts/cx-macos-arm64/cx-macos-arm64
artifacts/cx-macos-intel/cx-macos-intel
generate_release_notes: true
draft: true