-
-
Notifications
You must be signed in to change notification settings - Fork 105
270 lines (257 loc) · 13.1 KB
/
beta.build-push.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# build a new beta release and push it to apple
name: beta.build-push
# Controls when the action will run.
on:
# Triggers the workflow on push
push:
branches: [ beta ]
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
buildAndPublishBeta:
name: "Build and Publish Beta Release"
runs-on: self-hosted
outputs:
release-tag: ${{ steps.releasenotes.outputs.tag }}
release-name: ${{ steps.releasenotes.outputs.name }}
release-notes: ${{ steps.releasenotes.outputs.notes }}
env:
APP_NAME: "Monal"
BUILD_SCHEME: "Monal"
APP_DIR: "Monal.app"
BUILD_TYPE: "Beta"
EXPORT_OPTIONS_CATALYST_APPSTORE: "../scripts/exportOptions/Stable_Catalyst_ExportOptions.plist"
EXPORT_OPTIONS_CATALYST_APP_EXPORT: "../scripts/exportOptions/Beta_Catalyst_ExportOptions.plist"
EXPORT_OPTIONS_IOS: "../scripts/exportOptions/Beta_iOS_ExportOptions.plist"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
with:
clean: true
submodules: true
fetch-depth: 100
fetch-tags: true
show-progress: true
lfs: true
- name: Checkout submodules
run: git submodule update -f --init --remote
- name: Get last build tag and increment it
run: |
oldBuildNumber=$(git tag --sort="v:refname" | grep "Build_iOS" | grep -v "Quicksy_Build_iOS" | tail -n1 | sed 's/Build_iOS_//g')
buildNumber=$(expr $oldBuildNumber + 1)
echo "New buildNumber is $buildNumber"
git tag Build_iOS_$buildNumber
- name: Extract version number and changelog from newest merge commit
id: releasenotes
run: |
function repairNotes {
sed 's/\r//g' | awk '{
if (NR == 1) {
printf("%s", $0)
} else {
if ($0 ~ /^[\t ]*(-|IOS_ONLY[\t ]*-|MACOS_ONLY[\t ]*-).*$/) {
printf("\n%s", $0)
} else {
printf(" %s", $0)
}
}
}
END {
printf("\n")
}'
}
buildNumber="$(git tag --sort="v:refname" | grep "Build_iOS" | grep -v "Quicksy_Build_iOS" | tail -n1 | sed 's/Build_iOS_//g')"
version="$(git log -n 1 --merges --pretty=format:%s | sed -E 's/^[\t\n ]*([^\n\t ]+)[\t\n ]+\(([^\n\t ]+)\)[\t\n ]*$/\1/g')"
mkdir -p /Users/ci/releases
OUTPUT_FILE="/Users/ci/releases/$buildNumber.output"
touch "$OUTPUT_FILE"
echo "OUTPUT_FILE=$OUTPUT_FILE" | tee /dev/stderr >> "$GITHUB_OUTPUT"
echo "buildNumber=$buildNumber" | tee /dev/stderr >> "$OUTPUT_FILE"
echo "tag=Build_iOS_$buildNumber" | tee /dev/stderr >> "$OUTPUT_FILE"
echo "version=$version" | tee /dev/stderr >> "$OUTPUT_FILE"
echo "buildVersion=$(echo "$version" | grep -oE '^[0-9]+(\.[0-9]+){0,2}')" | tee /dev/stderr >> "$OUTPUT_FILE"
echo "name=Monal Beta $(git log -n 1 --merges --pretty=format:%s | sed -E 's/^[\t\n ]*([^\n\t ]+)[\t\n ]+\(([^\n\t ]+)\)[\t\n ]*$/\1 (Build '$buildNumber', PR \2)/g')" | tee /dev/stderr >> "$OUTPUT_FILE"
echo "notes<<__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE"
echo "$(git log -n 1 --merges --pretty=format:%b)" | repairNotes | sed -E 's/^[\t\n ]*IOS_ONLY[\t\n ]?(.*)$/\1/g' | sed -E 's/^[\t\n ]*MACOS_ONLY[\t\n ]?(.*)$/\1/g' | tee /dev/stderr >> "$OUTPUT_FILE"
echo "__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE"
echo "notes_ios<<__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE"
echo "$(git log -n 1 --merges --pretty=format:%b)" | repairNotes | grep -v '^[\t\n ]*MACOS_ONLY.*$' | sed -E 's/^[\t\n ]*IOS_ONLY[\t\n ]?(.*)$/\1/g' | tee /dev/stderr >> "$OUTPUT_FILE"
echo "__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE"
echo "notes_macos<<__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE"
echo "$(git log -n 1 --merges --pretty=format:%b)" | repairNotes | grep -v '^[\t\n ]*IOS_ONLY.*$' | sed -E 's/^[\t\n ]*MACOS_ONLY[\t\n ]?(.*)$/\1/g' | tee /dev/stderr >> "$OUTPUT_FILE"
echo "__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE"
cat "$OUTPUT_FILE" >> "$GITHUB_OUTPUT"
- name: Insert buildNumber and version into plists
env:
buildNumber: ${{ steps.releasenotes.outputs.buildNumber }}
buildVersion: ${{ steps.releasenotes.outputs.buildVersion }}
run: sh ./scripts/set_version_number.sh
- name: Import TURN secrets
run: |
if [[ -e "/Users/ci/secrets.monal_beta" ]]; then
echo "#import \"/Users/ci/secrets.monal_beta\"" > Monal/Classes/secrets.h
fi
- name: Make our build scripts executable
run: chmod +x ./scripts/build.sh
- name: Run build
run: ./scripts/build.sh
- uses: actions/upload-artifact@v4
with:
name: monal-ios
path: Monal/build/ipa/Monal.ipa
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: monal-catalyst-dsym
path: Monal/build/macos_Monal.xcarchive/dSYMs
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: monal-ios-dsym
path: Monal/build/ios_Monal.xcarchive/dSYMs
if-no-files-found: error
- name: validate ios app
run: xcrun altool --validate-app --file ./Monal/build/ipa/Monal.ipa --type ios --asc-provider S8D843U34Y -u "$(cat /Users/ci/apple_connect_upload_mail.txt)" -p "$(cat /Users/ci/apple_connect_upload_secret.txt)"
- name: Push beta tag to repo
run: |
buildNumber=$(git tag --sort="v:refname" | grep "Build_iOS" | grep -v "Quicksy_Build_iOS" | tail -n1 | sed 's/Build_iOS_//g')
git push origin Build_iOS_$buildNumber
# - name: Create fastlane whatsNew hash in environment
# id: buildinfo
# env:
# CHANGELOG_IOS: ${{ steps.releasenotes.outputs.notes_ios }}
# CHANGELOG_MACOS: ${{ steps.releasenotes.outputs.notes_macos }}
# run: |
# get_changelog() {
# local escaped=$(printf '%s\n' "$1" | jq -sRr @json)
# local json="{\"default\": {\"whats_new\": $escaped},"
# # for dir in ./appstore_metadata/*/; do
# # dir="$(basename "$dir")"
# # if [[ -d "./appstore_metadata/$dir" ]]; then
# # json="$json\"${dir%/}\": {\"whats_new\": $escaped},"
# # fi
# # done
# json="${json%,}}"
# echo "$json"
# }
# echo "buildinfo_ios<<__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT"
# echo "$(get_changelog "$CHANGELOG_IOS")" | tee /dev/stderr >> "$GITHUB_OUTPUT"
# echo "__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT"
#
# echo "buildinfo_macos<<__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT"
# echo "$(get_changelog "$CHANGELOG_MACOS")" | tee /dev/stderr >> "$GITHUB_OUTPUT"
# echo "__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT"
- name: Create fastlane localized_app_info hash in environment
id: appinfo
run: |
build_appinfo_entry() {
local escaped_marketing_url=$(cat ./appstore_metadata/$1/marketing_url.txt | jq -sRr @json)
local escaped_privacy_policy_url=$(cat ./appstore_metadata/$1/privacy_url.txt | jq -sRr @json)
local escaped_description=$(cat ./appstore_metadata/$1/description.txt | jq -sRr @json)
local json="{\"feedback_email\": \"info@monal-im.org\", \"marketing_url\": $escaped_marketing_url, \"privacy_policy_url\": $escaped_privacy_policy_url, \"description\": $escaped_description}"
echo "$json"
}
json="{"
json="$json\"default\": $(build_appinfo_entry "en-US"),"
for dir in ./appstore_metadata/*/; do
dir="$(basename "$dir")"
if [[ -d "./appstore_metadata/$dir" ]]; then
json="$json\"${dir%/}\": $(build_appinfo_entry "${dir%/}"),"
fi
done
json="${json%,}}"
echo "appinfo<<__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT"
echo "$json" | tee /dev/stderr >> "$GITHUB_OUTPUT"
echo "__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT"
- name: Publish ios to appstore connect
#run: xcrun altool --upload-app -f ./Monal/build/ipa/Monal.ipa --type ios --asc-provider S8D843U34Y --team-id S8D843U34Y -u "$(cat /Users/ci/apple_connect_upload_mail.txt)" -p "$(cat /Users/ci/apple_connect_upload_secret.txt)"
env:
#PILOT_LOCALIZED_BUILD_INFO: ${{ steps.buildinfo.outputs.buildinfo_ios }}
PILOT_LOCALIZED_APP_INFO: ${{ steps.appinfo.outputs.appinfo }}
PILOT_CHANGELOG: ${{ steps.releasenotes.outputs.notes_ios }}
run: |
fastlane run upload_to_testflight api_key_path:"/Users/ci/appstoreconnect/key.json" team_id:"S8D843U34Y" ipa:"./Monal/build/ipa/Monal.ipa" distribute_external:true notify_external_testers:true groups:"Internal Pre-Beta Testers","Public Beta" reject_build_waiting_for_review:true submit_beta_review:true
- name: Notarize catalyst
run: xcrun notarytool submit ./Monal/build/app/Monal.zip --wait --team-id S8D843U34Y --key "/Users/ci/appstoreconnect/apiKey.p8" --key-id "$(cat /Users/ci/appstoreconnect/apiKeyId.txt)" --issuer "$(cat /Users/ci/appstoreconnect/apiIssuerId.txt)"
- name: staple
run: |
cd Monal/build/app/tar_release/
xcrun stapler staple "$APP_DIR"
stapler validate "$APP_DIR"
/usr/bin/ditto -c -k --sequesterRsrc --keepParent "$APP_DIR" "../$APP_NAME.zip"
cd ../../../..
- uses: actions/upload-artifact@v4
with:
name: monal-catalyst-zip
path: Monal/build/app/Monal.zip
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: monal-catalyst-pkg
path: Monal/build/app/Monal.pkg
if-no-files-found: error
- name: Upload new catalyst beta to monal-im.org
run: ./scripts/uploadNonAlpha.sh beta
- name: Publish catalyst to appstore connect
#run: xcrun altool --upload-app --file ./Monal/build/app/Monal.pkg --type macos --asc-provider S8D843U34Y -u "$(cat /Users/ci/apple_connect_upload_mail.txt)" -p "$(cat /Users/ci/apple_connect_upload_secret.txt)" --primary-bundle-id org.monal-im.prod.catalyst.monal
env:
#PILOT_LOCALIZED_BUILD_INFO: ${{ steps.buildinfo.outputs.buildinfo_macos }}
PILOT_LOCALIZED_APP_INFO: ${{ steps.appinfo.outputs.appinfo }}
PILOT_CHANGELOG: ${{ steps.releasenotes.outputs.notes_macos }}
run: |
fastlane run upload_to_testflight api_key_path:"/Users/ci/appstoreconnect/key.json" team_id:"S8D843U34Y" pkg:"./Monal/build/app/Monal.pkg" distribute_external:true notify_external_testers:true groups:"Internal Pre-Beta Testers","Public Beta" reject_build_waiting_for_review:true submit_beta_review:true
- name: Release
uses: softprops/action-gh-release@v2
with:
name: "${{ steps.releasenotes.outputs.name }}"
tag_name: "${{ steps.releasenotes.outputs.tag }}"
target_commitish: beta
generate_release_notes: false
body: "${{ steps.releasenotes.outputs.notes }}"
files: |
./Monal/build/ipa/Monal.ipa
./Monal/build/app/Monal.pkg
./Monal/build/app/Monal.zip
fail_on_unmatched_files: true
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: true
updateTranslations:
name: Update Translations using Beta-Branch
runs-on: self-hosted
needs: [buildAndPublishBeta]
env:
APP_NAME: "Monal"
APP_DIR: "Monal.app"
BUILD_TYPE: "Beta"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
with:
clean: true
submodules: true
- name: Checkout submodules
run: git submodule update -f --init --remote
- name: Update translations
run: |
chmod +x ./scripts/updateLocalization.sh
chmod +x ./scripts/xliff_extractor.py
./scripts/updateLocalization.sh BUILDSERVER
notifyMuc:
name: Notify support MUC about new Betarelease
runs-on: ubuntu-latest
needs: [buildAndPublishBeta]
steps:
- name: Notify
uses: monal-im/xmpp-notifier@master
with: # Set the secrets as inputs
jid: ${{ secrets.BOT_JID }}
password: ${{ secrets.BOT_PASSWORD }}
server_host: ${{ secrets.BOT_SERVER }}
recipient: monal@chat.yax.im
recipient_is_room: true
bot_alias: "Monal Release Bot"
message: |
${{ needs.buildAndPublishBeta.outputs.release-name }} was released
${{ needs.buildAndPublishBeta.outputs.release-notes }}