-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (66 loc) · 2.21 KB
/
release.yml
File metadata and controls
82 lines (66 loc) · 2.21 KB
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
name: Build and Release
on:
push:
branches: [master]
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
ext: .exe
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
ext: ""
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
ext: ""
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: netmon
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build netmon
working-directory: netmon
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
run: cargo build --release --target ${{ matrix.target }}
- name: Package (Windows)
if: matrix.os == 'windows-latest'
run: Compress-Archive -Path "netmon/target/${{ matrix.target }}/release/netmon.exe" -DestinationPath "netmon-${{ matrix.target }}.zip"
- name: Package (Linux)
if: matrix.os != 'windows-latest'
run: zip "netmon-${{ matrix.target }}.zip" "netmon/target/${{ matrix.target }}/release/netmon"
- uses: actions/upload-artifact@v4
with:
name: netmon-${{ matrix.target }}
path: netmon-${{ matrix.target }}.zip
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Publish latest release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete latest --yes --cleanup-tag 2>/dev/null || true
gh release create latest artifacts/*.zip \
--prerelease \
--title "Latest Builds" \
--notes "Built from commit \`${{ github.sha }}\` on \`${{ github.ref_name }}\`."