-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (78 loc) · 2.75 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
84
85
86
87
88
89
90
name: Release
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
jobs:
publish:
name: Binary ${{ matrix.target }} (on ${{ matrix.os }})
runs-on: ${{ matrix.os }}
outputs:
version: ${{ steps.extract_version.outputs.version }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
cross: true
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
cross: true
- os: ubuntu-latest
target: armv7-unknown-linux-musleabihf
cross: true
- os: ubuntu-latest
target: arm-unknown-linux-musleabihf
cross: true
- os: windows-latest
target: x86_64-pc-windows-gnu
cross: false
- os: macos-latest
target: x86_64-apple-darwin
cross: false
- os: ubuntu-latest
target: wasm32-wasi
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- run: sudo apt install musl-tools
if: startsWith(matrix.os, 'ubuntu') && matrix.target != 'wasm32-wasi'
- name: cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --locked --target=${{ matrix.target }}
use-cross: ${{ matrix.cross }}
- name: Set exe extension for Windows
run: echo "EXE=.exe" >> $env:GITHUB_ENV
if: startsWith(matrix.os, 'windows')
- name: Set wasm extension for WASM
run: echo "WASM=.wasm" >> $GITHUB_ENV
if: matrix.target == 'wasm32-wasi'
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/flipnote-id${{ env.EXE }}${{ env.WASM }}
- name: Get version from tag
id: extract_version
run: |
echo ::set-output name=version::${GITHUB_REF_NAME#v}
shell: bash
- name: Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/flipnote-id${{ env.EXE }}${{ env.WASM }}
tag: ${{ github.ref_name }}
asset_name: flipnote-id-${{ steps.extract_version.outputs.version }}-${{ matrix.target }}${{ env.EXE }}${{ env.WASM }}
body: v${{ steps.extract_version.outputs.version }}
if: startsWith(github.ref_name, 'v') && github.ref_type == 'tag'