-
Notifications
You must be signed in to change notification settings - Fork 2
92 lines (84 loc) · 2.84 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch: # This adds the manual trigger option
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
extension: ""
archive: tar.gz
- os: macos-latest
target: x86_64-apple-darwin
extension: ""
archive: tar.gz
- os: macos-14
target: aarch64-apple-darwin
extension: ""
archive: tar.gz
- os: ubuntu-latest
target: x86_64-pc-windows-gnu
extension: .exe
archive: tar.gz
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install MinGW for Windows cross-compilation
if: matrix.target == 'x86_64-pc-windows-gnu'
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64
- name: Download NPCAP SDK
if: contains(matrix.target, 'windows')
run: |
wget https://npcap.com/dist/npcap-sdk-1.13.zip -O /tmp/sdk.zip
unzip /tmp/sdk.zip -d /tmp/sdk
mkdir -p /tmp/sdk/lib/x64
mkdir -p /tmp/sdk86/lib
mkdir -p /tmp/sdkarm/lib
cp /tmp/sdk/Lib/x64/*lib /tmp/sdk/lib/x64
cp /tmp/sdk/Lib/x64/*lib /tmp/sdk/lib
cp /tmp/sdk/Lib/*lib /tmp/sdk86/lib
cp -r /tmp/sdk/Include /tmp/sdk86
cp /tmp/sdk/Lib/ARM64/*lib /tmp/sdkarm/lib
cp -r /tmp/sdk/Include /tmp/sdkarm
- name: Build for Linux/macOS/Windows
run: |
cargo build --release --target ${{ matrix.target }}
mkdir -p release/yapppwn-${{ matrix.target }}
cp target/${{ matrix.target }}/release/yapppwn${{ matrix.extension }} release/yapppwn-${{ matrix.target }}/yapppwn${{ matrix.extension }}
- name: Package artifact
run: |
cd release
tar -czf yapppwn-${{ matrix.target }}.${{ matrix.archive }} yapppwn-${{ matrix.target }}/yapppwn${{ matrix.extension }}
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: yapppwn-${{ matrix.target }}.${{ matrix.archive }}
path: release/yapppwn-${{ matrix.target }}.${{ matrix.archive }}
create_release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: artifacts/**/*
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}