-
Notifications
You must be signed in to change notification settings - Fork 9
74 lines (68 loc) · 2.36 KB
/
Copy pathrelease.yml
File metadata and controls
74 lines (68 loc) · 2.36 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
name: Release
on:
release:
types: [created]
push:
tags:
- 'v*'
jobs:
release:
name: release ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-gnu
os: ubuntu-latest
archive: zip
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
archive: tar.gz
- target: x86_64-apple-darwin
os: macos-latest
archive: zip
- target: aarch64-apple-darwin
os: macos-latest
archive: zip
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev pkg-config
if [[ "${{ matrix.target }}" == *"musl"* ]]; then
sudo apt-get install -y musl-tools
fi
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Create archive
run: |
mkdir -p release
if [[ "${{ matrix.archive }}" == "zip" ]]; then
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
cp target/${{ matrix.target }}/release/musix.exe release/
cd release && zip ../musix-${{ matrix.target }}.zip musix.exe
else
cp target/${{ matrix.target }}/release/musix release/
cd release && zip ../musix-${{ matrix.target }}.zip musix
fi
else
cp target/${{ matrix.target }}/release/musix release/
cd release && tar -czf ../musix-${{ matrix.target }}.tar.gz musix
fi
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./musix-${{ matrix.target }}.${{ matrix.archive == 'zip' && 'zip' || 'tar.gz' }}
asset_name: musix-${{ matrix.target }}.${{ matrix.archive == 'zip' && 'zip' || 'tar.gz' }}
asset_content_type: application/octet-stream