-
Notifications
You must be signed in to change notification settings - Fork 0
/
artifact.sh
executable file
·103 lines (85 loc) · 3.29 KB
/
artifact.sh
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
#!/bin/sh
CURRENT_DIR=$(pwd)
download() {
if [ -d "./artifacts" ]; then
echo "The artifacts directory already exists, please remove it first."
exit 1
fi
echo "Downloading the artifacts..."
mkdir -p ./artifacts
# # download the artifact by the following commands, select the all openconnect-xx artifacts
gh run download --dir ./artifacts
echo ""
echo "Renaming the CLI binaries..."
if [ -d "./artifacts/openconnect-linux-x64" ]; then
mv ./artifacts/openconnect-linux-x64/openconnect-cli ./artifacts/openconnect-linux-x64/openconnect-cli_linux-x86_64
fi
if [ -d "./artifacts/openconnect-mac-aarch64" ]; then
mv ./artifacts/openconnect-mac-aarch64/openconnect-cli ./artifacts/openconnect-mac-aarch64/openconnect-cli_osx-aarch64
fi
if [ -d "./artifacts/openconnect-mac-x64" ]; then
mv ./artifacts/openconnect-mac-x64/openconnect-cli ./artifacts/openconnect-mac-x64/openconnect-cli_osx-x86_64
fi
echo ""
echo "Renaming the GUI binaries..."
if [ -d "./artifacts/openconnect-win" ]; then
mv ./artifacts/openconnect-win/msi/*.msi ./artifacts/openconnect-win/msi/openconnect-gui_win-x86_64.msi
mv ./artifacts/openconnect-win/nsis/*.exe ./artifacts/openconnect-win/nsis/openconnect-gui_win-x86_64.exe
fi
echo ""
if [[ "$OSTYPE" = "darwin"* ]]; then
# codesign the macos bundle
CODESIGN_IDENTITY=$(security find-identity -p codesigning | grep "CSSMERR_TP_NOT_TRUSTED" | awk '{print $3}' | tr -d '"')
# process the macos aarch64 bundle
echo "Codesigning the macos aarch64 bundle..."
cd ./artifacts/openconnect-mac-aarch64/bundle/macos
chmod +x ./openconnect-gui.app/Contents/MacOS/openconnect-gui
codesign -fs "$CODESIGN_IDENTITY" ./openconnect-gui.app
echo ""
echo "Creating the aarch 64 dmg files..."
# create dmg
create-dmg \
--volname "Openconnect GUI" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 100 \
--icon "openconnect-gui.app" 200 190 \
--hide-extension "openconnect-gui.app" \
--app-drop-link 600 185 \
"openconnect-gui_osx-aarch64.dmg" \
"openconnect-gui.app/"
cd $CURRENT_DIR
echo ""
# process the macos x86_64 bundle
echo "Codesigning the macos x86_64 bundle..."
cd ./artifacts/openconnect-mac-x64/bundle/macos
chmod +x ./openconnect-gui.app/Contents/MacOS/openconnect-gui
codesign -fs "$CODESIGN_IDENTITY" ./openconnect-gui.app
echo ""
echo "Creating the x86_64 dmg files..."
create-dmg \
--volname "Openconnect GUI" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 100 \
--icon "openconnect-gui.app" 200 190 \
--hide-extension "openconnect-gui.app" \
--app-drop-link 600 185 \
"openconnect-gui_osx-x86_64.dmg" \
"openconnect-gui.app/"
cd $CURRENT_DIR
echo ""
fi
}
clean() {
echo "Cleaning the artifacts..."
rm -rf ./artifacts
}
if [ "$1" = "download" ]; then
download
elif [ "$1" = "clean" ]; then
clean
else
echo "Usage: $0 {download|clean}"
exit 1
fi