-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.67 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
name: Release
on:
push:
tags:
- 'v*.*.*'
jobs:
release:
strategy:
matrix:
config:
- { os: ubuntu-latest, target: 'x86_64-unknown-linux-gnu' }
- { os: ubuntu-latest, target: 'x86_64-unknown-linux-musl' }
- { os: ubuntu-latest, target: 'aarch64-unknown-linux-gnu' }
- { os: ubuntu-latest, target: 'aarch64-unknown-linux-musl' }
- { os: macos-latest, target: 'x86_64-apple-darwin' }
- { os: macos-latest, target: 'aarch64-apple-darwin' }
# - { os: windows-latest, target: 'x86_64-pc-windows-gnu' }
- { os: windows-latest, target: 'x86_64-pc-windows-msvc' }
runs-on: ${{ matrix.config.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies for Ubuntu
if: matrix.config.os == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install -y libssl-dev pkg-config build-essential
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.config.target }}
- name: Build with cross
run: |
cargo install cross
cross build --release --target ${{ matrix.config.target }}
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.target }}
path: |
if: matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'macos-latest'
target/${{ matrix.config.target }}/release/jobcan
if: matrix.config.os == 'windows-latest'
target/${{ matrix.config.target }}/release/jobcan.exe
- name: Compress binary for ubuntu and macos
if: matrix.config.os == 'ubuntu-latest' || matrix.config.os == 'macos-latest'
run: |
cd target/${{ matrix.config.target }}/release
tar -czf jobcan-${{ matrix.config.target }}.tar.gz jobcan
- name: Compress binary for windows
if: matrix.config.os == 'windows-latest'
run: |
cd target/${{ matrix.config.target }}/release
Compress-Archive -Path jobcan.exe -Destination jobcan-${{ matrix.config.target }}.zip
- name: Create release draft
uses: softprops/action-gh-release@v1
with:
files: |
target/${{ matrix.config.target }}/release/jobcan-${{ matrix.config.target }}.tar.gz
target/${{ matrix.config.target }}/release/jobcan-${{ matrix.config.target }}.zip
draft: true
token: ${{ secrets.TOKEN_FOR_RELEASE }}
generate_release_notes: true
fail_on_unmatched_files: false