-
Notifications
You must be signed in to change notification settings - Fork 16
89 lines (78 loc) · 2.4 KB
/
cd.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
name: CD
on:
push:
tags:
- v*
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
file: target/release/systemctl-tui
args: --best --lzma
strip: true
- os: windows-latest
file: target/release/systemctl-tui.exe
args: -9
strip: false
- os: macos-latest
file: target/release/systemctl-tui
args: --best
strip: true
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Cache Cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache Cargo target
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: |
cargo build --verbose --release
- name: Compress binaries
uses: svenstaro/upx-action@v2
with:
files: ${{ matrix.file }}
args: ${{ matrix.args }}
strip: ${{ matrix.strip }}
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: systemctl-tui-${{ matrix.os }}
path: |
target/release/systemctl-tui${{ matrix.os == 'windows-latest' && '.exe' || '' }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/release/systemctl-tui${{ matrix.os == 'windows-latest' && '.exe' || '' }}
asset_name: systemctl-tui-${{ matrix.os }}
asset_content_type: application/octet-stream