-
Notifications
You must be signed in to change notification settings - Fork 20
90 lines (76 loc) · 2.55 KB
/
Copy pathbuild-cli.yml
File metadata and controls
90 lines (76 loc) · 2.55 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
name: Build CLI
on:
push:
tags:
- "v*"
jobs:
build-cli:
runs-on: ${{ matrix.build-on }}
strategy:
matrix:
include:
# Linux - musl for fully static binaries
- target: x86_64-unknown-linux-musl
archive: tar.gz
build-on: ubuntu-latest
use-cross: true
- target: aarch64-unknown-linux-musl
archive: tar.gz
build-on: ubuntu-latest
use-cross: true
# macOS
- target: x86_64-apple-darwin
archive: tar.gz
build-on: macos-15
use-cross: false
- target: aarch64-apple-darwin
archive: tar.gz
build-on: macos-latest
use-cross: false
# Windows
- target: x86_64-pc-windows-msvc
archive: zip
build-on: windows-latest
use-cross: false
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install cross
if: matrix.use-cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: Set version from tag
shell: bash
run: |
VERSION="${GITHUB_REF_NAME#v}"
sed -i.bak "s/^version = \".*\"/version = \"$VERSION\"/" cli/Cargo.toml
- name: Build (native)
if: ${{ !matrix.use-cross }}
run: cargo build --release --target ${{ matrix.target }} --bin stakgraph --manifest-path cli/Cargo.toml
- name: Build with cross
if: matrix.use-cross
run: cross build --release --target ${{ matrix.target }} --bin stakgraph --manifest-path cli/Cargo.toml
- name: Package (Unix)
if: matrix.archive == 'tar.gz'
run: |
cd cli/target/${{ matrix.target }}/release
tar czf stakgraph-${{ matrix.target }}.tar.gz stakgraph
- name: Package (Windows)
if: matrix.archive == 'zip'
shell: bash
run: |
cd cli/target/${{ matrix.target }}/release
7z a stakgraph-${{ matrix.target }}.zip stakgraph.exe
- uses: actions/upload-artifact@v4
with:
name: stakgraph-${{ matrix.target }}
path: cli/target/${{ matrix.target }}/release/stakgraph-${{ matrix.target }}.${{ matrix.archive }}
release:
needs: build-cli
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
- uses: softprops/action-gh-release@v1
with:
files: stakgraph-*/stakgraph-*.*