forked from SamNet-dev/findns
-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (177 loc) · 6.59 KB
/
Copy pathrelease.yml
File metadata and controls
204 lines (177 loc) · 6.59 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
suffix: linux-amd64
ext: ""
- goos: linux
goarch: arm64
suffix: linux-arm64
ext: ""
- goos: darwin
goarch: amd64
suffix: darwin-amd64
ext: ""
- goos: darwin
goarch: arm64
suffix: darwin-arm64
ext: ""
- goos: windows
goarch: amd64
suffix: windows-amd64
ext: ".exe"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: go build -ldflags="-s -w" -o findns-${{ matrix.suffix }}${{ matrix.ext }} ./cmd
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: findns-${{ matrix.suffix }}
path: findns-${{ matrix.suffix }}${{ matrix.ext }}
build-slipstream:
runs-on: ubuntu-latest
steps:
- name: Install build deps
run: |
sudo apt-get update
sudo apt-get install -y cmake pkg-config libssl-dev git
- uses: dtolnay/rust-toolchain@stable
- name: Clone slipstream-rust
run: git clone --recursive https://github.com/Mygod/slipstream-rust.git /tmp/slipstream-rust
- name: Build slipstream-client
working-directory: /tmp/slipstream-rust
env:
PICOQUIC_AUTO_BUILD: "1"
run: cargo build -p slipstream-client --release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: slipstream-client-linux-amd64
path: /tmp/slipstream-rust/target/release/slipstream-client
bundle-masterdnsvpn-client:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- upstream: MasterDnsVPN_Client_Linux_AMD64.tar.gz
archive: tar
out: masterdnsvpn-client-linux-amd64
- upstream: MasterDnsVPN_Client_Linux_ARM64.tar.gz
archive: tar
out: masterdnsvpn-client-linux-arm64
- upstream: MasterDnsVPN_Client_MacOS_AMD64.tar.gz
archive: tar
out: masterdnsvpn-client-darwin-amd64
- upstream: MasterDnsVPN_Client_MacOS_ARM64.tar.gz
archive: tar
out: masterdnsvpn-client-darwin-arm64
- upstream: MasterDnsVPN_Client_Windows_AMD64.zip
archive: zip
out: masterdnsvpn-client-windows-amd64.exe
steps:
- name: Download upstream MasterDnsVPN client
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p /tmp/mdvpn
gh release download --repo masterking32/MasterDnsVPN \
--pattern '${{ matrix.upstream }}' \
--dir /tmp/mdvpn
- name: Extract single client binary
run: |
set -eu
cd /tmp/mdvpn
if [ "${{ matrix.archive }}" = "tar" ]; then
tar -xzf '${{ matrix.upstream }}'
else
unzip -o '${{ matrix.upstream }}'
fi
# Upstream tarballs contain exactly one executable named like
# MasterDnsVPN_Client_<Platform>_<arch>_<version>[.exe]. Find it
# by matching the prefix and excluding archive/readme files.
src=$(find . -maxdepth 1 -type f \
\( -name 'MasterDnsVPN_Client_*' -a ! -name '*.tar.gz' -a ! -name '*.zip' -a ! -name '*.html' \) \
| head -n1)
if [ -z "$src" ]; then
echo "could not locate extracted MasterDnsVPN client binary" >&2
ls -la
exit 1
fi
cp "$src" '${{ matrix.out }}'
chmod +x '${{ matrix.out }}'
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.out }}
path: /tmp/mdvpn/${{ matrix.out }}
release:
needs: [build, build-slipstream, bundle-masterdnsvpn-client]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Stage per-platform release zips
# Each release zip ships everything a user needs to run findns on
# that platform: the findns binary (renamed to the canonical
# findns / findns.exe), the matching masterdnsvpn-client binary,
# the bundled CIDR list, and a short README. linux-amd64 also
# includes slipstream-client when the rust build produced one.
run: |
set -eu
mkdir -p out stage
# Normalise the slipstream artifact name (download-artifact
# collapses the directory; the file may end up as either
# slipstream-client or slipstream-client-linux-amd64).
if [ -f artifacts/slipstream-client ] && [ ! -f artifacts/slipstream-client-linux-amd64 ]; then
mv artifacts/slipstream-client artifacts/slipstream-client-linux-amd64
fi
version="${GITHUB_REF_NAME:-dev}"
package() {
os=$1; arch=$2; ext=$3
name="findns-${os}-${arch}"
dir="stage/${name}"
mkdir -p "${dir}"
cp "artifacts/findns-${os}-${arch}${ext}" "${dir}/findns${ext}"
cp "artifacts/masterdnsvpn-client-${os}-${arch}${ext}" "${dir}/masterdnsvpn-client${ext}"
cp scan_ips_public.txt "${dir}/scan_ips_public.txt"
if [ "${os}-${arch}" = "linux-amd64" ] && [ -f artifacts/slipstream-client-linux-amd64 ]; then
cp artifacts/slipstream-client-linux-amd64 "${dir}/slipstream-client"
fi
chmod +x "${dir}/findns${ext}" "${dir}/masterdnsvpn-client${ext}" 2>/dev/null || true
[ -f "${dir}/slipstream-client" ] && chmod +x "${dir}/slipstream-client" || true
python3 .github/release/render_readme.py "${os}" "${arch}" "${ext}" "${version}" "${dir}/README.txt"
(cd stage && zip -r "../out/${name}.zip" "${name}" >/dev/null)
ls -la "out/${name}.zip"
}
package linux amd64 ""
package linux arm64 ""
package darwin amd64 ""
package darwin arm64 ""
package windows amd64 .exe
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: out/*.zip
generate_release_notes: true