-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathafter_success.sh
More file actions
executable file
·132 lines (105 loc) · 3.69 KB
/
Copy pathafter_success.sh
File metadata and controls
executable file
·132 lines (105 loc) · 3.69 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
#!/bin/bash
set -ev
#
# creating the Moolticute.dmg with Applications link
#
SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source $SCRIPTDIR/../funcs.sh
source $SCRIPTDIR/env.sh
VERSION="$(get_version .)"
#Only build if the commit we are building is for the last tag
if [ "$(git rev-list -n 1 $VERSION)" != "$(git rev-parse HEAD)" ]; then
echo "Not uploading package"
exit 0
fi
detect_qtdir
MACDEPLOYQT_BIN="$(macdeployqt_bin)"
APP=Moolticute
# this directory name will also be shown in the title when the DMG is mounted
TEMPDIR=build/$APP
SIGNATURE="Raoul Hecky"
NAME=`uname`
if [ "$NAME" != "Darwin" ]; then
echo "This is not a Mac"
exit 1
fi
echo "Copy plist from script directory"
cp $SCRIPTDIR/Info.plist build/$APP.app/Contents/Info.plist
cat build/$APP.app/Contents/Info.plist
# Copy daemon to bundle
cp build/moolticuted build/$APP.app/Contents/MacOS/
# Bundle architecture-matching CLI tools
mkdir -p build/$APP.app/Contents/MacOS/cli
bundle_mc_cli_tools build/$APP.app/Contents/MacOS/cli
# use macdeployqt to deploy the application
echo "Calling macdeployqt"
$MACDEPLOYQT_BIN build/$APP.app
if [ "$?" -ne "0" ]; then
echo "Failed to run macdeployqt"
exit 1
fi
#Call fix to change all rpath
#wget_retry https://raw.githubusercontent.com/mooltipass/macdeployqtfix/master/macdeployqtfix.py
#python3 macdeployqtfix.py build/$APP.app/Contents/MacOS/moolticute /Users/travis/Qt/6.2.4/macos/
#python3 macdeployqtfix.py build/$APP.app/Contents/MacOS/moolticuted /Users/travis/Qt/6.2.4/macos/
#setup keychain
KEYCHAIN="travis.keychain"
KEYCHAIN_PW="mooltipass"
security create-keychain -p $KEYCHAIN_PW $KEYCHAIN
security default-keychain -s $KEYCHAIN
security set-keychain-settings $KEYCHAIN
security unlock-keychain -p $KEYCHAIN_PW $KEYCHAIN
security import $HOME/cert.p12 -k $KEYCHAIN -P "$CODESIGN_OSX_PASS" -A
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PW $KEYCHAIN || true # do not fail
# Use first ID
security find-identity -v $KEYCHAIN
export ID=$(security find-identity -v $KEYCHAIN | grep "1)" | sed "s/^ *1) *\([^ ]*\).*/\1/")
echo "Using ID: $ID"
#Sign binaries!
codesign --deep --force --options runtime --verbose --sign $ID --keychain $KEYCHAIN build/$APP.app
echo "Verifying code signed app"
codesign --verify --verbose=4 build/$APP.app
spctl --assess --verbose=4 --raw build/$APP.app
#install https://github.com/andreyvit/create-dmg
brew install create-dmg
create-dmg \
--volname "$APP" \
--volicon "img/AppIcon.icns" \
--background "img/dmg_background.png" \
--window-pos 100 100 \
--window-size 640 480 \
--icon-size 128 \
--icon "$APP.app" 192 344 \
--app-drop-link 448 344 \
--skip-jenkins \
build/$APP-$VERSION.dmg \
build/$APP.app
#sign dmg
codesign --force --verify --verbose --sign "$ID" build/$APP-$VERSION.dmg
#echo "Verifying code signed disk image"
#codesign --verify --verbose=4 build/$APP-$VERSION.dmg
#spctl --assess --verbose=4 --raw build/$APP-$VERSION.dmg
echo "Removing keys"
# remove keys
security delete-keychain $KEYCHAIN
#create update manifest
cat > build/updater_osx.json <<EOF
[{
"tag_name": "$VERSION",
"html_url": "https://mooltipass-tests.com/mc_betas/$VERSION",
"body": "",
"assets": [{
"name": "$APP-$VERSION",
"browser_download_url": "https://mooltipass-tests.com/mc_betas/$VERSION/$APP-$VERSION.dmg"
}]
}]
EOF
#Check if this is a test release or not
if endsWith -testing "$VERSION" ; then
export SFTP_USER=${MC_BETA_UPLOAD_SFTP_USER}
export SFTP_PASS=${MC_BETA_UPLOAD_SFTP_PASS}
PATH=${PATH}:$(pwd)/scripts/lib create_beta_release_osx ${BUILD_TAG}
else
PATH=${PATH}:$(pwd)/scripts/lib create_github_release_osx ${BUILD_TAG}
fi
exit 0