-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (61 loc) · 1.83 KB
/
github-actions.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
name: CI Workflow
on:
push:
branches: ["main"]
tags: ["*"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create release
if: startsWith(github.ref, 'refs/tags/')
env:
GH_TOKEN: ${{ github.token }}
run: gh release create ${{ github.ref_name }}
build:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
# Linux
- name: linux-amd64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
command: cargo
# Android
- name: android-arm
runner: ubuntu-latest
target: aarch64-linux-android
command: cross
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
uses: dtolnay/rust-toolchain@stable
- name: Install cross
if: matrix.command == 'cross'
shell: bash
run: |
cargo install cross --git https://github.com/cross-rs/cross
- name: Build binary
run: ${{ matrix.command }} build --release --target ${{ matrix.target }}
- name: Create archive
if: startsWith(github.ref, 'refs/tags/')
id: archive
shell: bash
run: |
DIRECTORY="loadtimer-${{ github.ref_name }}-${{ matrix.target}}"
mkdir "${DIRECTORY}"
cp target/${{ matrix.target }}/release/loadtimer "${DIRECTORY}/"
7z a "${DIRECTORY}.zip" "${DIRECTORY}"
echo "path=${DIRECTORY}.zip" >> ${GITHUB_OUTPUT}
- name: Release
if: startsWith(github.ref, 'refs/tags/')
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload ${{ github.ref_name }} ${{ steps.archive.outputs.path }}