-
Notifications
You must be signed in to change notification settings - Fork 3
87 lines (75 loc) · 2.81 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
# For reference see:
# https://github.com/NuroDev/rust-cross-release/blob/main/.github/workflows/release.yml
name: Release
# TODO: Add manual workflow using `workflow_dispatch`
on:
release:
types:
- created
push:
tags:
- 'v*'
jobs:
binary:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: innit
asset_name: innit-${{ github.event.release.tag_name }}-linux-x86_64
use_cross: true
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: innit
asset_name: innit-${{ github.event.release.tag_name }}-linux-musl-x86_64
use_cross: true
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: innit
asset_name: innit-${{ github.event.release.tag_name }}-macos-x86_64
# TODO: Figure out how to install additional targets on the runner.
# Refer to https://www.rohanjain.in/cargo-cross/
# https://github.com/marketplace/actions/set-up-a-rust-toolchain
# - os: macos-latest
# target: aarch64-apple-darwin
# artifact_name: innit
# asset_name: innit-${{ github.event.release.tag_name }}-macos-aarch64
# TODO: Add support for more Windows toolchains (i686-pc-windows-gnu, i686-pc-windows-msvc & x86_64-pc-windows-gnu)
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: innit.exe
asset_name: innit-${{ github.event.release.tag_name }}-windows-x86_64
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "stable"
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
use-cross: ${{ matrix.use_cross }}
args: --verbose --release --target=${{ matrix.target }}
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.asset_name }}
path: ./target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
# TODO: Zip only Windows releases, use bash `tar` to archive all *unix assets
- name: Archive Release
uses: vimtor/action-zip@v1
with:
files: ./target/${{ matrix.target }}/release/${{ matrix.artifact_name }} ./LICENSE
dest: ${{ matrix.asset_name }}.zip
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
files: ${{ matrix.asset_name }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}