-
Notifications
You must be signed in to change notification settings - Fork 286
158 lines (148 loc) · 5.33 KB
/
ci.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
---
name: build
on:
push:
branches-ignore:
- 'translations_**'
tags:
- 'v*'
pull_request:
branches-ignore:
- 'translations_**'
jobs:
build:
runs-on: macos-12
env:
QS_DONT_SIGN: 1
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Build debug version
working-directory: Quicksilver
run: |
./Tools/qsrelease Debug
mv /tmp/QS/build/Debug/Quicksilver{,-debug}.zip
- name: Upload debug version
uses: actions/upload-artifact@v3
with:
name: Quicksilver-debug
path: /tmp/QS/build/Debug/Quicksilver-debug.zip
- name: Build release version
working-directory: Quicksilver
run: |
./Tools/qsrelease
cp ./SharedSupport/ChangesBare.html /tmp
- name: Prepare DMG_INGREDIENTS artifact
working-directory: /tmp/QS/build/Release/
run: |
cp \
/tmp/qs_build_settings \
/tmp/Quicksilver.entitlements \
/tmp/ChangesBare.html \
./dmg/
tar -czvf ./dmg_ingredients.tar.gz ./dmg
- name: Upload components for sign action
uses: actions/upload-artifact@v3
with:
name: DMG_INGREDIENTS
path: /tmp/QS/build/Release/dmg_ingredients.tar.gz
sign:
needs: build
runs-on: macos-11
if: startsWith(github.ref, 'refs/tags/')
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
SIGNING_IDENTITY: ${{ secrets.SIGNING_IDENTITY }}
NOTARIZING_ID: ${{ secrets.NOTARIZING_ID }}
NOTARIZING_PASS: ${{ secrets.NOTARIZING_PASS }}
KEYCHAIN_PROFILE: "Quicksilver Notarization"
steps:
- name: Download dmg folder artifact
uses: actions/download-artifact@v3
with:
name: DMG_INGREDIENTS
path: /tmp/QS/build/Release/
- name: Decompress DMG_INGREDIENTS
working-directory: /tmp/QS/build/Release/
run: |
tar -xzvf ./dmg_ingredients.tar.gz
mv \
./dmg/qs_build_settings \
./dmg/Quicksilver.entitlements \
./dmg/ChangesBare.html \
/tmp/
QS_INFO_VERSION=$(awk '/QS_INFO_VERSION/ { print $NF }' \
/tmp/qs_build_settings)
echo "QS_INFO_VERSION=${QS_INFO_VERSION}" >> "${GITHUB_ENV}"
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Run Tools/qssign
working-directory: Quicksilver
run: |
# https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development
KEYCHAIN_PATH=${RUNNER_TEMP}/app-signing.keychain-db
CERTIFICATE_PATH=${RUNNER_TEMP}/build_certificate.p12
echo -n "${MACOS_CERTIFICATE}" | base64 --decode \
--output "${CERTIFICATE_PATH}"
security create-keychain -p "${KEYCHAIN_PASSWORD}" "${KEYCHAIN_PATH}"
security default-keychain -s "${KEYCHAIN_PATH}"
security set-keychain-settings -lut 21600 "${KEYCHAIN_PATH}"
security unlock-keychain -p "${KEYCHAIN_PASSWORD}" "${KEYCHAIN_PATH}"
security import "${CERTIFICATE_PATH}" \
-P "${MACOS_CERTIFICATE_PASSWORD}" \
-A -t cert -f pkcs12 -k "${KEYCHAIN_PATH}"
xcrun notarytool store-credentials "${KEYCHAIN_PROFILE}" \
--apple-id "${NOTARIZING_ID}" \
--team-id "${SIGNING_IDENTITY}" \
--password "${NOTARIZING_PASS}"
./Tools/qssign
- name: Download debug artifact
uses: actions/download-artifact@v3
with:
name: Quicksilver-debug
path: /tmp
- name: Create checksum
run: |
cd /tmp/QS/build/Release/
shasum --algorithm 256 Quicksilver*.dmg > checksum.txt
cd /tmp
shasum --algorithm 256 Quicksilver-debug.zip >> /tmp/QS/build/Release/checksum.txt
- name: Upload Quicksilver.dmg
uses: actions/upload-artifact@v3
with:
name: "Quicksilver_${{ env.QS_INFO_VERSION }}.dmg"
path: /tmp/QS/build/Release/Quicksilver*.dmg
- name: Upload checksum
uses: actions/upload-artifact@v3
with:
name: checksums
path: /tmp/QS/build/Release/checksum.txt
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
/tmp/QS/build/Release/Quicksilver*.dmg
/tmp/QS/build/Release/checksum.txt
/tmp/Quicksilver-debug.zip
- name: Update ChangesBare.html
env:
SERVER: ${{ secrets.SERVER }}
PORT: ${{ secrets.PORT }}
SSH_KEY: ${{secrets.SSH_KEY}}
run: |
# Create ssh keyfile with locked down permissions and ensure its removal
# Unfortunately process substitution won't work because ssh closes
# all fd > 2
touch /tmp/key
chmod 0600 /tmp/key
trap 'rm -f /tmp/key' EXIT
echo "${SSH_KEY}" > /tmp/key
ssh -T "${SERVER}" -p "${PORT}" -i /tmp/key \
-o StrictHostKeyChecking=no \
"${GITHUB_REPOSITORY}" \
</tmp/ChangesBare.html
rm /tmp/key