forked from ltaoo/wx_channels_download
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (110 loc) · 5.39 KB
/
release.yml
File metadata and controls
124 lines (110 loc) · 5.39 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
goreleaser:
name: Release
runs-on: ubuntu-latest
env:
MAC_CERT_P12: ${{ secrets.MAC_CERT_P12 }}
MAC_CERT_PASSWORD: ${{ secrets.MAC_CERT_PASSWORD }}
NOTARY_PRIVATE_KEY: ${{ secrets.NOTARY_PRIVATE_KEY }}
NOTARY_KEY_ID: ${{ secrets.NOTARY_KEY_ID }}
NOTARY_ISSUER_ID: ${{ secrets.NOTARY_ISSUER_ID }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Install cross-compiler for windows
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64
# TODO: Temporarily disabled SunnyNet build
# - name: Patch SunnyNet for MinGW
# run: |
# go mod vendor
# SUNNYNET_DIR="vendor/github.com/qtgolang/SunnyNet"
#
# # Fix case-sensitive filename issue (Linux is case-sensitive)
# mv $SUNNYNET_DIR/src/ProcessDrv/Proxifier/proxifier.hpp $SUNNYNET_DIR/src/ProcessDrv/Proxifier/Proxifier.hpp
#
# # Patch header file - rename structs and types to avoid MinGW conflicts
# sed -i 's/typedef struct _MIB_TCPROW2 {/typedef struct _MIB_TCPROW2_CUSTOM {/' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.h
# sed -i 's/} MIB_TCPROW2, \*PMIB_TCPROW2;/} MIB_TCPROW2_CUSTOM, *PMIB_TCPROW2_CUSTOM;/' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.h
# sed -i 's/typedef struct _MIB_TCPTABLE2 {/typedef struct _MIB_TCPTABLE2_CUSTOM {/' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.h
# sed -i 's/MIB_TCPROW2 table\[ANY_SIZE\];/MIB_TCPROW2_CUSTOM table[ANY_SIZE];/' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.h
# sed -i 's/} MIB_TCPTABLE2, \*PMIB_TCPTABLE2;/} MIB_TCPTABLE2_CUSTOM, *PMIB_TCPTABLE2_CUSTOM;/' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.h
# sed -i 's/typedef DWORD (WINAPI \* GetTcpTable2)(PMIB_TCPTABLE2 TcpTable, PULONG SizePointer, BOOL Order);/typedef DWORD (WINAPI * GetTcpTable2_CUSTOM)(PMIB_TCPTABLE2_CUSTOM TcpTable, PULONG SizePointer, BOOL Order);/' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.h
#
# # Patch C file - use renamed types everywhere
# sed -i 's/GetTcpTable2 pGetTcpTable2;/GetTcpTable2_CUSTOM pGetTcpTable2;/' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.c
# sed -i 's/(GetTcpTable2)/(GetTcpTable2_CUSTOM)/g' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.c
# sed -i 's/(PMIB_TCPTABLE2)/(PMIB_TCPTABLE2_CUSTOM)/g' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.c
# sed -i 's/PMIB_TCPTABLE2 pTcpTable;/PMIB_TCPTABLE2_CUSTOM pTcpTable;/' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.c
# sed -i 's/PMIB_TCPTABLE2 tcpTable/PMIB_TCPTABLE2_CUSTOM tcpTable/g' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.c
# sed -i 's/pTcpTable = (MIB_TCPTABLE2\*)/pTcpTable = (MIB_TCPTABLE2_CUSTOM*)/g' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.c
# sed -i 's/tcpTable = (MIB_TCPTABLE2\*)/tcpTable = (MIB_TCPTABLE2_CUSTOM*)/g' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.c
# sed -i 's/MIB_TCPROW2 \*row/MIB_TCPROW2_CUSTOM *row/g' $SUNNYNET_DIR/src/iphlpapi/c_iphlpapi_tcp.c
- name: Generate Windows resources (.syso)
run: |
set -e
go run github.com/tc-hib/go-winres@latest make --in ./winres/winres.json --arch amd64
go run github.com/tc-hib/go-winres@latest make --in ./winres/winres.json --arch arm64
- name: Install rcodesign
run: |
set -e
curl -L -o rcodesign.tar.gz https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.22.0/apple-codesign-0.22.0-x86_64-unknown-linux-musl.tar.gz
tar -xvf rcodesign.tar.gz
mv apple-codesign-0.22.0-x86_64-unknown-linux-musl/rcodesign /usr/local/bin/
rm -rf rcodesign.tar.gz apple-codesign-0.22.0-x86_64-unknown-linux-musl
- name: Prepare secrets
run: |
set -e
echo "${{ secrets.MAC_CERT_P12 }}" | base64 --decode > cert.p12
echo "${{ secrets.NOTARY_PRIVATE_KEY }}" | base64 --decode > AuthKey.p8
- name: Build with GoReleaser (skip publish & validate)
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --skip=publish,validate --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAC_CERT_P12_FILE: cert.p12
MAC_CERT_PASSWORD: ${{ secrets.MAC_CERT_PASSWORD }}
- name: Create API key JSON for notarization
run: |
rcodesign encode-app-store-connect-api-key \
"${{ secrets.NOTARY_ISSUER_ID }}" \
"${{ secrets.NOTARY_KEY_ID }}" \
AuthKey.p8 \
> api-key.json
- name: Notarize macOS archives
run: |
set -e
for file in dist/*darwin*.zip; do
if [ -f "$file" ]; then
echo "Notarizing $file..."
rcodesign notary-submit \
--api-key-path api-key.json \
--wait \
"$file"
fi
done
- name: Create GitHub Release and upload assets
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
dist/*.tar.gz
dist/*.zip
dist/*checksums.txt