Skip to content

Commit 3cd3a3c

Browse files
Cloak for macos fat binary ci/cd implemented
[cloak]
1 parent 9c90bdf commit 3cd3a3c

File tree

1 file changed

+60
-86
lines changed

1 file changed

+60
-86
lines changed

.github/workflows/build_cloak.yml

Lines changed: 60 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on: [push]
44

55

66
jobs:
7-
87
Build-Cloak:
98
name: 'Build-Cloak'
109
runs-on: ubuntu-latest
@@ -52,64 +51,65 @@ jobs:
5251
mkdir ./release/plugin/linux
5352
CGO_ENABLED=1 GOOS="linux" GOARCH="amd64" go build -v -o ./release/plugin/linux/ck-ovpn-plugin.a -buildmode=c-archive ./cmd/ck-ovpn-plugin/
5453
mkdir ./release/plugin/windows
55-
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS="windows" GOARCH="amd64" go build -v -o ./release/plugin/windows/ck-ovpn-plugin.dll -buildmode=c-shared ./cmd/ck-ovpn-plugin/
54+
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS="windows" GOARCH="amd64" go build -v -o ./release/plugin/windows/ck-ovpn-plugin.dll -buildmode=c-shared ./cmd/ck-ovpn-plugin/
5655
5756
- name: Archive Linux client binary
58-
uses: actions/upload-artifact@v3
57+
uses: actions/upload-artifact@v4
5958
with:
6059
retention-days: 1
6160
name: ck-client-linux
6261
path: '~/work/3rd-build-ga/3rd-build-ga/Cloak/release/ck-client-linux*'
6362

6463
- name: Archive Windows client binary
65-
uses: actions/upload-artifact@v3
64+
uses: actions/upload-artifact@v4
6665
with:
6766
retention-days: 1
6867
name: ck-client-windows
6968
path: '~/work/3rd-build-ga/3rd-build-ga/Cloak/release/ck-client-windows*'
7069

7170
- name: Archive Darwin client binary
72-
uses: actions/upload-artifact@v3
71+
uses: actions/upload-artifact@v4
7372
with:
7473
retention-days: 1
7574
name: ck-client-darwin
7675
path: '~/work/3rd-build-ga/3rd-build-ga/Cloak/release/ck-client-darwin*'
7776

7877
- name: Archive Linux server binary
79-
uses: actions/upload-artifact@v3
78+
uses: actions/upload-artifact@v4
8079
with:
8180
retention-days: 1
8281
name: ck-server
8382
path: '~/work/3rd-build-ga/3rd-build-ga/Cloak/release/ck-server-linux*'
8483

8584
- name: Archive Plugin
86-
uses: actions/upload-artifact@v3
85+
uses: actions/upload-artifact@v4
8786
with:
8887
retention-days: 1
8988
name: desktop-plugin
9089
path: '~/work/3rd-build-ga/3rd-build-ga/Cloak/release/plugin'
9190

9291
Build-Cloak-MacOS:
93-
runs-on: macos-12
92+
runs-on: macos-13
9493
if: |
9594
contains(github.event.head_commit.message, '[all]') ||
9695
contains(github.event.head_commit.message, '[macos]') ||
9796
contains(github.event.head_commit.message, '[cloak]')
9897
99-
name: "Build Cloak Desktop plugin"
98+
name: "Build Cloak macOS plugin (fat)"
10099
steps:
101100

102101
- name: Get Cloak
103-
uses: actions/checkout@v3
102+
uses: actions/checkout@v4
104103
with:
105104
repository: amnezia-vpn/Cloak
106105
ref: master-amnezia
107106
path: Cloak
108107

109-
# - name: 'Run build script'
110-
# working-directory: Cloak
111-
# run: |
112-
# CGO_ENABLED=1 GOOS="darwin" GOARCH="amd64" go build -v -o ./release/plugin/darwin/ck-ovpn-plugin.a -buildmode=c-archive ./cmd/ck-ovpn-plugin/
108+
- name: Set up Go
109+
uses: actions/setup-go@v5
110+
with:
111+
go-version: '1.21'
112+
113113
- name: Build for x86_64
114114
working-directory: Cloak
115115
run: |
@@ -126,14 +126,15 @@ jobs:
126126
lipo -create -output ./release/plugin/darwin/ck-ovpn-plugin.a \
127127
./release/plugin/darwin/ck-ovpn-plugin-x86_64.a \
128128
./release/plugin/darwin/ck-ovpn-plugin-arm64.a
129+
129130
- name: Archive artifacts
130-
uses: actions/upload-artifact@v3
131+
uses: actions/upload-artifact@v4
131132
with:
132-
name: darwin-pt
133+
name: ck-macos-plugin
133134
path: Cloak/release/plugin
134135

135136
Build-Cloak-iOS:
136-
runs-on: macos-12
137+
runs-on: macos-13
137138
if: |
138139
contains(github.event.head_commit.message, '[all]') ||
139140
contains(github.event.head_commit.message, '[ios]') ||
@@ -143,102 +144,75 @@ jobs:
143144
steps:
144145

145146
- name: Get Cloak
146-
uses: actions/checkout@v3
147+
uses: actions/checkout@v4
147148
with:
148149
repository: amnezia-vpn/Cloak
149150
ref: master-amnezia
150151
path: Cloak
151152

153+
- name: Set up Go
154+
uses: actions/setup-go@v5
155+
with:
156+
go-version: '1.21'
157+
152158
- name: 'Run build script'
153159
working-directory: Cloak
154160
run: |
155161
GOOS=ios GOARCH=arm64 GOFLAGS="-tags=ios" CGO_CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -miphoneos-version-min=9.0 -fembed-bitcode -arch arm64" CGO_CXXFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -miphoneos-version-min=9.0 -fembed-bitcode -arch arm64" CGO_LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -miphoneos-version-min=9.0 -fembed-bitcode -arch arm64" CGO_ENABLED=1 go build -buildmode=c-archive -o ck-ovpn-plugin.a ./cmd/ck-ovpn-plugin
156162
157163
- name: Archive iOS client binary
158-
uses: actions/upload-artifact@v3
164+
uses: actions/upload-artifact@v4
159165
with:
160166
retention-days: 1
161167
name: ck-ios-plugin
162168
path: '~/work/3rd-build-ga/3rd-build-ga/Cloak/ck-ovpn-plugin*'
163169

164170
github-release:
165171
name: GitHub Release
166-
needs: Build-Cloak
172+
needs: [Build-Cloak, Build-Cloak-iOS, Build-Cloak-MacOS]
167173
runs-on: ubuntu-latest
168174
if: startsWith(github.ref, 'refs/tags/')
169-
170175
steps:
171176
- name: Setup | Checkout
172-
uses: actions/checkout@v2
173-
174-
- name: Setup | Artifacts
175-
uses: actions/download-artifact@v2
176-
177-
- name: Setup | Checksums
178-
run: for file in $(find ./ -name '*' ); do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
179-
180-
- name: Zip ALL
181-
run: for file in *; do zip -r ${file%.*}.zip $file; done
182-
183-
- name: Upload binaries to release
184-
uses: svenstaro/upload-release-action@v2
185-
with:
186-
repo_token: ${{ secrets.GITHUB_TOKEN }}
187-
file: ck-client-linux.zip
188-
tag: ${{ github.ref }}
189-
overwrite: true
190-
file_glob: true
191-
192-
- name: Upload binaries to release
193-
uses: svenstaro/upload-release-action@v2
194-
with:
195-
repo_token: ${{ secrets.GITHUB_TOKEN }}
196-
file: ck-client-windows.zip
197-
tag: ${{ github.ref }}
198-
overwrite: true
199-
file_glob: true
200-
201-
- name: Upload binaries to release
202-
uses: svenstaro/upload-release-action@v2
203-
with:
204-
repo_token: ${{ secrets.GITHUB_TOKEN }}
205-
file: ck-client-darwin.zip
206-
tag: ${{ github.ref }}
207-
overwrite: true
208-
file_glob: true
177+
uses: actions/checkout@v4
209178

210-
- name: Upload binaries to release
211-
uses: svenstaro/upload-release-action@v2
212-
with:
213-
repo_token: ${{ secrets.GITHUB_TOKEN }}
214-
file: ck-server.zip
215-
tag: ${{ github.ref }}
216-
overwrite: true
217-
file_glob: true
179+
- name: Download all Artifacts
180+
uses: actions/download-artifact@v4
218181

219-
- name: Upload binaries to release
182+
- name: Generate Checksums for Cloak Artifacts
183+
run: |
184+
# List all artifact patterns you expect.
185+
for path in ck-client-linux* ck-client-windows* ck-client-darwin* ck-server* ck-ios-plugin* ck-macos-plugin desktop-plugin; do
186+
if [ -e "$path" ]; then
187+
echo "Processing $path"
188+
if [ -d "$path" ]; then
189+
find "$path" -type f -exec sh -c 'openssl dgst -sha256 -r "$1" > "$1.sha256"' _ {} \;
190+
else
191+
openssl dgst -sha256 -r "$path" > "$path.sha256"
192+
fi
193+
fi
194+
done
195+
196+
- name: Zip artifacts individually
197+
run: |
198+
for artifact in ck-client-linux ck-client-windows ck-client-darwin ck-server ck-ios-plugin ck-macos-plugin desktop-plugin; do
199+
if [ -d "$artifact" ]; then
200+
echo "Zipping directory $artifact..."
201+
zip -r "${artifact}.zip" "$artifact"
202+
elif [ -f "$artifact" ]; then
203+
echo "Zipping file $artifact..."
204+
zip "${artifact}.zip" "$artifact"
205+
fi
206+
done
207+
208+
- name: List generated ZIP files
209+
run: ls -l *.zip
210+
211+
- name: Upload ZIP archives to GitHub Release
220212
uses: svenstaro/upload-release-action@v2
221213
with:
222214
repo_token: ${{ secrets.GITHUB_TOKEN }}
223-
file: ck-ios-plugin.zip
224215
tag: ${{ github.ref }}
225216
overwrite: true
217+
file: "*.zip"
226218
file_glob: true
227-
228-
- name: Upload binaries to release
229-
uses: svenstaro/upload-release-action@v2
230-
with:
231-
repo_token: ${{ secrets.GITHUB_TOKEN }}
232-
file: darwin-pt.zip
233-
tag: ${{ github.ref }}
234-
overwrite: true
235-
file_glob: true
236-
237-
- name: Upload binaries to release
238-
uses: svenstaro/upload-release-action@v2
239-
with:
240-
repo_token: ${{ secrets.GITHUB_TOKEN }}
241-
file: desktop-plugin.zip
242-
tag: ${{ github.ref }}
243-
overwrite: true
244-
file_glob: true

0 commit comments

Comments
 (0)