-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (85 loc) · 2.75 KB
/
rust.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
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Rust
on:
push:
branches: [ "master" ]
tags: ["[0-9]+.[0-9]+.[0-9]+"]
paths-ignore:
- "LICENSE-MIT"
- "LICENSE-APACHE"
- "README.md"
- "SECURITY.MD"
- ".gitignore"
- "docs/**"
- "install.sh"
- "aft-relay.service"
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
include:
- build: Linux x86-64
os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
archive_name: aft-linux-x86_64.gz
- build: Windows x86-64
os: windows-latest
target: x86_64-pc-windows-gnu
archive_name: aft-windows-gnu-x86_64.zip
- build: Windows x86-64 MSVC
os: windows-latest
target: x86_64-pc-windows-msvc
archive_name: aft-windows-msvc-x86_64.zip
- build: macOS x86-64
os: macos-latest
target: x86_64-apple-darwin
archive_name: aft-macos-x86_64.gz
- build: macOS AArch64/ARM
os: macos-latest
target: aarch64-apple-darwin
archive_name: aft-macos-aarch64.gz
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: Build release
run: |
cargo update
cargo build --release --verbose --target ${{ matrix.target }}
- name: Compress Windows
if: matrix.os == 'windows-latest'
shell: pwsh
run: Get-ChildItem -Path ./target -Recurse -Filter 'aft.exe' | Compress-Archive -DestinationPath ./${{ matrix.archive_name }}
- name: Compress Linux/macOS
if: matrix.os != 'windows-latest'
run: gzip -cN target/**/release/aft > ${{ matrix.archive_name }}
- uses: actions/upload-artifact@v4.3.3
with:
name: ${{ matrix.archive_name }}
path: ./${{ matrix.archive_name }}
publish-release:
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: ~/archives/
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: create_release
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG=$(git describe --tags --abbrev=0)
gh release create $TAG --draft --notes "# What's new since the latest release" --generate-notes --title "v$TAG" ~/archives/**/*