-
Notifications
You must be signed in to change notification settings - Fork 41
57 lines (52 loc) · 2.03 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
# from: https://faun.pub/automate-your-build-release-with-github-actions-367c0febf5fd
name: Release CI
on:
push:
branches: ["main"]
jobs:
deploy:
# A strategy is used to define various build environments this job will run.
#
# To say it simple, this will create 3 separate independent jobs which will
# run on ubuntu, mac & windows.
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
# Runs when the commit message contains "[Release]"
if: "contains(github.event.head_commit.message, '[Release]')"
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
default: true
profile: minimal
- name: Build
run: cargo build -p rustdx-cmd --release
# Condition to only run this whenever the runner os is Mac
- name: Build Release Mac
if: matrix.os == 'macos-latest'
run: mv target/release/rustdx target/release/rustdx-macos
# Condition to only run this whenever the runner os is Ubuntu
- name: Build Release Linux
if: matrix.os == 'ubuntu-latest'
run: mv target/release/rustdx target/release/rustdx-linux
# Condition to only run this whenever the runner os is Windows
# - name: Build Release Win
# if: matrix.os == 'windows-latest'
# run: mv target/release/rustdx.exe target/release/rustdx.exe
# This will draft a new release & will attach the binaries produced by the above outputs.
# You still need to publish this release though after job ends.
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
# name: Release ${{ github.ref }}
draft: true
files: |
./target/release/rustdx-*
./target/release/rustdx.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # You don't need to add this in secrets it's by default.