-
Notifications
You must be signed in to change notification settings - Fork 17
83 lines (70 loc) · 3.05 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
82
83
name: Release
on:
push:
tags: [ 'v*' ]
jobs:
build:
strategy:
fail-fast: false
matrix:
targets: [
{ os: ubuntu-latest, target: x86_64-unknown-linux-musl, tool: cargo, name: linux64, ext: '' },
{ os: ubuntu-latest, target: i686-unknown-linux-musl, tool: cross, name: linux32, ext: '' },
{ os: ubuntu-latest, target: aarch64-unknown-linux-musl, tool: cross, name: linux-arm64, ext: '' },
{ os: macos-latest, target: x86_64-apple-darwin, tool: cargo, name: mac64, ext: '' },
{ os: macos-latest, target: aarch64-apple-darwin, tool: cross, name: mac-arm64, ext: '' },
{ os: windows-latest, target: x86_64-pc-windows-msvc, tool: cargo, name: windows64, ext: '.exe' },
{ os: windows-latest, target: i686-pc-windows-msvc, tool: cargo, name: windows32, ext: '.exe' },
{ os: windows-latest, target: aarch64-pc-windows-msvc, tool: cargo, name: windows-arm64, ext: '.exe' }
]
runs-on: ${{ matrix.targets.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: "${{ matrix.targets.target }}"
- uses: Swatinem/rust-cache@v2
- name: Add rust target
run: rustup target add ${{ matrix.targets.target }}
- name: Setup target ${{ matrix.targets.target }}
if: ${{ matrix.targets.target == 'aarch64-apple-darwin' }}
run: |
echo "SDKROOT=$(xcrun -sdk macosx11.1 --show-sdk-path)" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version)" >> $GITHUB_ENV
- name: Install cross
if: ${{ matrix.targets.tool == 'cross' }}
run: cargo install cross
- name: Build gyro2bb
working-directory: bin/gyro2bb/
run: ${{ matrix.targets.tool }} build --target ${{ matrix.targets.target }} --release
- name: Strip
if: ${{ matrix.targets.os != 'windows-latest' }}
continue-on-error: true
working-directory: bin/gyro2bb/
run: strip target/${{ matrix.targets.target }}/release/gyro2bb 2>/dev/null || true
- name: Copy dist
working-directory: bin/gyro2bb/
run: |
mkdir ../../dist
mv target/${{ matrix.targets.target }}/release/gyro2bb${{ matrix.targets.ext }} ../../dist/gyro2bb-${{ matrix.targets.name }}${{ matrix.targets.ext }}
- name: Save Binaries
uses: actions/upload-artifact@v4
with:
name: gyro2bb
path: dist/gyro2bb*
github_release:
name: Create GitHub release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: gyro2bb
- run: ls -l
- name: Publish
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./*