This repository has been archived by the owner on Oct 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (69 loc) · 2.49 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
name: Build and Upload Rust Binaries
on:
release:
types: [created]
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
filename: downapk-x86_64-linux
- os: macos-latest
target: x86_64-apple-darwin
filename: downapk-x86_64-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
filename: downapk-x86_64-windows.exe
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
filename: downapk-aarch64-linux
- os: macos-latest
target: aarch64-apple-darwin
filename: downapk-aarch64-darwin
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies for aarch64
if: matrix.os == 'ubuntu-latest' && contains(matrix.target, 'aarch64') == true
run: sudo apt install -y g++-aarch64-linux-gnu libc6-dev-arm64-cross
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Add target
run: |
rustup target add ${{ matrix.target }}
rustup toolchain install stable-${{ matrix.target }}
- name: Additional configs for aarch64
if: matrix.os == 'ubuntu-latest' && contains(matrix.target, 'aarch64') == true
run: |
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc
export CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
if: contains(matrix.target, 'windows') == false
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/downapk
asset_name: ${{ matrix.filename }}
tag: ${{ github.ref }}
file_glob: false
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
if: contains(matrix.target, 'windows') == true
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/downapk.exe
asset_name: ${{ matrix.filename }}
tag: ${{ github.ref }}
file_glob: false