-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (68 loc) · 2.2 KB
/
release.yml
File metadata and controls
81 lines (68 loc) · 2.2 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build-release:
name: Build Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: extstat
asset_name: extstat-linux-x86_64
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: extstat
asset_name: extstat-linux-x86_64-musl
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: extstat
asset_name: extstat-macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: extstat
asset_name: extstat-macos-aarch64
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install musl tools (Linux musl only)
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get install -y musl-tools
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Strip binary (Linux/macOS)
if: matrix.os != 'windows-latest'
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
- name: Create archive
run: |
mkdir archive
cp target/${{ matrix.target }}/release/${{ matrix.artifact_name }} archive/
cp README.md LICENSE archive/
cd archive
tar czf ../${{ matrix.asset_name }}.tar.gz *
- name: Upload binaries to release
uses: softprops/action-gh-release@v1
with:
files: ${{ matrix.asset_name }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cargo-publish:
name: Publish to crates.io
runs-on: ubuntu-latest
needs: build-release
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CARGO_TOKEN }}
continue-on-error: true