-
Notifications
You must be signed in to change notification settings - Fork 19
78 lines (64 loc) · 2.06 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:
workflow_dispatch: {}
push:
tags:
- v[0-9]*
jobs:
release:
name: Release
strategy:
matrix:
include:
- os: windows-2022
target: x86_64-pc-windows-msvc
- os: ubuntu-22.04
target: x86_64-unknown-linux-musl
- os: macos-12
target: x86_64-apple-darwin
- os: macos-12
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Rust Toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install target
run: rustup target add ${{ matrix.target }}
if: contains(fromJSON('["x86_64-unknown-linux-musl", "aarch64-apple-darwin"]'), matrix.target)
- name: Install musl-tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install musl-tools
- name: Build
run: cargo build --verbose --locked -F bin --release --target ${{ matrix.target }}
- name: Package
id: package
shell: bash
run: |
shopt -s extglob
staging="keepawake-${{ github.head_ref || github.ref_name }}-${{ matrix.target }}"
mkdir $staging
ls -R target/${{ matrix.target }}/release/
cp target/${{ matrix.target }}/release/keepawake@(|.exe) $staging/
cp README.md CHANGELOG.md LICENSE $staging/
tar zcf $staging.tar.gz $staging
echo "ASSET=$staging.tar.gz" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
with:
name: release-${{ matrix.os }}
path: ${{ steps.package.outputs.ASSET }}
- name: Release
uses: softprops/action-gh-release@v1
if: github.ref_type == 'tag'
with:
draft: true
files: ${{ steps.package.outputs.ASSET }}
merge:
runs-on: ubuntu-22.04
needs: release
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: release
pattern: release-*