-
-
Notifications
You must be signed in to change notification settings - Fork 93
151 lines (125 loc) · 5.23 KB
/
build-gui_mac.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
name: MacOS GUI
on:
push:
tags:
- '*'
branches:
- master
- v2.2x
paths:
- '.github/workflows/build-gui_mac.yml'
- 'gui/src/**'
pull_request:
branches:
- master
paths:
- '.github/workflows/build-gui_mac.yml'
- 'gui/src/**'
workflow_dispatch:
jobs:
build:
runs-on: macos-11
steps:
- name: Select XCode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '12.5.1'
- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==2.1.*'
version: '6.4.1'
modules: 'qtserialport'
setup-python: false
- name: Generate Icons
working-directory: ${{github.workspace}}
run: |
cd gui/src/images
bash -x svg2icns.bash IconFile.png
- name: Build
working-directory: ${{github.workspace}}
run: |
cd gui/src
ls
qmake HeadTracker.pro
make
- name: prepare output
working-directory: ${{github.workspace}}
run: |
mkdir output
cp -R gui/src/HeadTracker.app output/HeadTracker.app
# cp gui/src/css/stylesheet.css output/HeadTracker.app/Contents/MacOs
# cp gui/src/css/Background.svg output/HeadTracker.app/Contents/MacOs
# https://docs.github.com/en/[email protected]/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development
- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
# PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
# echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
# mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
# cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
# https://localazy.com/blog/how-to-automatically-sign-macos-apps-using-github-actions
# https://successfulsoftware.net/2018/11/16/how-to-notarize-your-software-on-macos/
- name: Notarize executable
working-directory: ${{github.workspace}}/output
env:
APPLE_DEV_IDENTITY: ${{ secrets.APPLE_DEV_IDENTITY }}
APPLE_DEV_USER: ${{ secrets.APPLE_DEV_USER }}
APPLE_DEV_PASS: ${{ secrets.APPLE_DEV_PASS }}
ENV_APP_NAME: HeadTracker
ENV_BUNDLE_ID: net.headtracker.gui
run: |
macdeployqt ${ENV_APP_NAME}.app -dmg -sign-for-notarization="${APPLE_DEV_IDENTITY}"
mkdir dmg
# take the latest tag as version
VERSION=$(git describe --tags --abbrev=0)
mv ${ENV_APP_NAME}.dmg dmg/${ENV_APP_NAME}-${VERSION}.dmg
echo "--> Start Notarization process"
response=$(xcrun altool -t osx -f dmg/${ENV_APP_NAME}-${VERSION}.dmg --primary-bundle-id ${ENV_BUNDLE_ID} --notarize-app -u ${APPLE_DEV_USER} -p @env:APPLE_DEV_PASS)
requestUUID=$(echo "${response}" | tr ' ' '\n' | tail -1)
while true; do
echo "--> Checking notarization status req[${requestUUID}]"
statusCheckResponse=$(xcrun altool --notarization-info ${requestUUID} -u ${APPLE_DEV_USER} -p @env:APPLE_DEV_PASS)
isSuccess=$(echo "${statusCheckResponse}" | grep "success" | cat)
isFailure=$(echo "${statusCheckResponse}" | grep "invalid" | cat)
if [[ "${isSuccess}" != "" ]]; then
echo "Notarization done!"
xcrun stapler staple -v dmg/${ENV_APP_NAME}-${VERSION}.dmg
echo "Stapler done!"
break
fi
if [[ "${isFailure}" != "" ]]; then
echo "Notarization failed"
exit 1
fi
echo "Notarization not finished yet, sleep 2m then check again..."
sleep 120
done
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: HeadTracker_MacOs
path: ${{github.workspace}}/output/dmg
retention-days: 60