-
Notifications
You must be signed in to change notification settings - Fork 22
105 lines (90 loc) · 3.12 KB
/
build-release.yml
File metadata and controls
105 lines (90 loc) · 3.12 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Build and Release
on:
push:
branches: [main]
tags:
- 'v*.*.*'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build Linux binaries
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Cache Cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build (release)
run: cargo build --release --bins
- name: Rename binaries for upload
run: |
cp target/release/client candy-spoof-client-linux-x86_64
cp target/release/server candy-spoof-server-linux-x86_64
- name: Upload client artifact
uses: actions/upload-artifact@v4
with:
name: candy-spoof-client-linux-x86_64
path: candy-spoof-client-linux-x86_64
- name: Upload server artifact
uses: actions/upload-artifact@v4
with:
name: candy-spoof-server-linux-x86_64
path: candy-spoof-server-linux-x86_64
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
# Only run on version tags or manual dispatch from main
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
permissions:
contents: write
steps:
- name: Download client binary
uses: actions/download-artifact@v4
with:
name: candy-spoof-client-linux-x86_64
- name: Download server binary
uses: actions/download-artifact@v4
with:
name: candy-spoof-server-linux-x86_64
- name: Determine release tag
id: tag
run: |
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
echo "TAG=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
else
echo "TAG=nightly-$(date +'%Y%m%d-%H%M%S')" >> "$GITHUB_OUTPUT"
fi
- name: Create release and upload binaries
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.TAG }}
name: "Candy-Spoof ${{ steps.tag.outputs.TAG }}"
body: |
## Candy-Spoof Release ${{ steps.tag.outputs.TAG }}
### Downloads
| Binary | Platform |
|--------|----------|
| `candy-spoof-client-linux-x86_64` | Linux x86_64 client (SOCKS5 proxy) |
| `candy-spoof-server-linux-x86_64` | Linux x86_64 server (tunnel endpoint) |
> **Note:** Both binaries require `CAP_NET_RAW` or root privileges to
> use raw sockets for IP spoofing.
files: |
candy-spoof-client-linux-x86_64
candy-spoof-server-linux-x86_64
draft: false
prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }}