-
Notifications
You must be signed in to change notification settings - Fork 6
177 lines (157 loc) · 6.26 KB
/
build_openvpnadapter_apple.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
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
name: Build OpenVPNAdapter for Apple
on: [push]
jobs:
build-macos:
name: 'OpenVPNAdapter for macOS'
runs-on: macos-latest
if: |
contains(github.event.head_commit.message, '[all]') ||
contains(github.event.head_commit.message, '[macos]') ||
contains(github.event.head_commit.message, '[openvpnadapter-ios]') ||
contains(github.event.head_commit.message, '[openvpnadapter]')
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: amnezia-vpn/OpenVPNAdapter
path: OpenVPNAdapter
ref: macox-cicd
submodules: recursive
- name: Configure amnezia.xcconfig
run: |
WORKINGDIR=$(pwd)
echo "Configuring amnezia.xcconfig..."
cat << EOF > $WORKINGDIR/OpenVPNAdapter/Configuration/amnezia.xcconfig
PROJECT_TEMP_DIR = $WORKINGDIR/OpenVPNAdapter/build/OpenVPNAdapter.build
CONFIGURATION_BUILD_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-macos
BUILT_PRODUCTS_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-macos
SKIP_INSTALL = NO
BUILD_LIBRARY_FOR_DISTRIBUTION = YES
CODE_SIGNING_ALLOWED = NO
CODE_SIGNING_REQUIRED = NO
EOF
- name: Print macOS SDK Version
run: |
MACOSX_SDK=$(xcrun --sdk macosx --show-sdk-path | sed -E 's/.*MacOSX([0-9]+\.[0-9]+)\.sdk/\1/')
echo "Using macOS SDK version: $MACOSX_SDK"
- name: Build OpenVPNAdapter for macOS
run: |
echo "Building OpenVPNAdapter for macOS..."
xcrun xcodebuild \
-project OpenVPNAdapter/OpenVPNAdapter.xcodeproj \
-xcconfig OpenVPNAdapter/Configuration/amnezia.xcconfig \
-scheme OpenVPNAdapter \
-destination 'generic/platform=macOS' \
-configuration Release \
-sdk macosx
- name: Generate Checksums for OpenVPNAdapter.framework
run: |
export WORKINGDIR=`pwd`
if [ -d "$WORKINGDIR/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework" ]; then
echo "Generating checksums for OpenVPNAdapter.framework..."
find $WORKINGDIR/OpenVPNAdapter/build/Release-macos \
-type f \
-exec sh -c 'openssl dgst -sha256 -r "$1" > "$1.sha256"' _ {} \;
else
echo "Directory $WORKINGDIR/OpenVPNAdapter/build/Release-macos/OpenVPNAdapter.framework does not exist."
exit 1
fi
- name: Archive Build
uses: actions/upload-artifact@v4
with:
name: OpenVPNAdapter-macos
path: 'OpenVPNAdapter/build/Release-macos'
build-ios:
name: 'OpenVPNAdapter for iOS'
runs-on: macos-latest
if: |
contains(github.event.head_commit.message, '[all]') ||
contains(github.event.head_commit.message, '[ios]') ||
contains(github.event.head_commit.message, '[openvpnadapter-ios]') ||
contains(github.event.head_commit.message, '[openvpnadapter]')
steps:
- name: Get OpenVPNAdapter
uses: actions/checkout@v4
with:
repository: amnezia-vpn/OpenVPNAdapter
ref: macox-cicd
path: OpenVPNAdapter
submodules: recursive
- name: Configure amnezia.xcconfig
run: |
WORKINGDIR=$(pwd)
echo "Configuring amnezia.xcconfig..."
cat << EOF > $WORKINGDIR/OpenVPNAdapter/Configuration/amnezia.xcconfig
PROJECT_TEMP_DIR = $WORKINGDIR/OpenVPNAdapter/build/OpenVPNAdapter.build
CONFIGURATION_BUILD_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos
BUILT_PRODUCTS_DIR = $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos
SKIP_INSTALL = NO
BUILD_LIBRARY_FOR_DISTRIBUTION = YES
CODE_SIGNING_ALLOWED = NO
CODE_SIGNING_REQUIRED = NO
EOF
- name: Build OpenVPNAdapter for iOS
run: |
echo "Building OpenVPNAdapter for iOS..."
xcrun xcodebuild \
-project OpenVPNAdapter/OpenVPNAdapter.xcodeproj \
-xcconfig OpenVPNAdapter/Configuration/amnezia.xcconfig \
-scheme OpenVPNAdapter \
-destination 'generic/platform=iOS' \
-configuration Release \
-sdk iphoneos
- name: Generate Checksums for OpenVPNAdapter.framework
run: |
export WORKINGDIR=`pwd`
if [ -d "$WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework" ]; then
echo "Generating checksums for OpenVPNAdapter.framework..."
find $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos \
-type f \
-exec sh -c 'openssl dgst -sha256 -r "$1" > "$1.sha256"' _ {} \;
else
echo "Directory $WORKINGDIR/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework does not exist."
exit 1
fi
- name: Archive Build
uses: actions/upload-artifact@v4
with:
name: OpenVPNAdapter-ios
path: 'OpenVPNAdapter/build/Release-iphoneos'
github-release:
name: GitHub Release
needs: [build-ios, build-macos]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Setup | Checkout
uses: actions/checkout@v4
- name: Download iOS Artifact
uses: actions/download-artifact@v4
with:
name: OpenVPNAdapter-ios
path: openvpnadapter-ios/
- name: Download macOS Artifact
uses: actions/download-artifact@v4
with:
name: OpenVPNAdapter-macos
path: openvpnadapter-macos/
- name: Create Combined Folder
run: |
mkdir -p openvpnadapter/ios
mkdir -p openvpnadapter/macos
cp -r openvpnadapter-ios/* openvpnadapter/ios/
cp -r openvpnadapter-macos/* openvpnadapter/macos/
- name: Zip Combined Artifacts
run: |
zip -r openvpnadapter.zip openvpnadapter/
shell: bash
- name: List Generated Files
run: ls -l
- name: Upload Binaries to GitHub Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
file: openvpnadapter.zip
file_glob: false