-
Notifications
You must be signed in to change notification settings - Fork 10
94 lines (87 loc) · 3.55 KB
/
Copy pathdeploy.yml
File metadata and controls
94 lines (87 loc) · 3.55 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
name: Deploy to TestFlight (Xcode Cloud)
# Manually trigger the "Deploy Flipcash" Xcode Cloud workflow for a branch and,
# optionally, wait for the build and assign it to a TestFlight group.
#
# These lanes only call the App Store Connect API (no Xcode compile), so this
# runs on a cheap ubuntu runner rather than macOS.
#
# Required repository secrets:
# ASC_KEY_ID - App Store Connect API Key ID
# ASC_ISSUER_ID - App Store Connect Issuer ID
# ASC_KEY_CONTENT - App Store Connect API Key (.p8) contents, base64-encoded
# APP_IDENTIFIER - App bundle identifier
# TESTFLIGHT_GROUP - default TestFlight group to assign builds to
# (kept in secrets so the name stays out of the repo)
#
# The optional "notes" input overwrites the build's TestFlight "What to Test"
# after it processes; leaving it blank keeps whatever Xcode Cloud attached from
# the branch's committed TestFlight/WhatToTest.en-US.txt.
on:
workflow_dispatch:
inputs:
branch:
description: Branch to build (must be pushed to origin)
required: true
default: main
group:
description: 'TestFlight group — leave blank to use the TESTFLIGHT_GROUP secret; type "none" to trigger only'
required: false
default: ""
notes:
description: 'TestFlight "What to Test" — blank keeps the notes Xcode Cloud takes from TestFlight/WhatToTest.en-US.txt. Use \n for line breaks.'
required: false
default: ""
wait:
description: Wait for the build to finish, set the notes, and assign it to the group
required: false
default: true
type: boolean
concurrency:
group: deploy-${{ inputs.branch }}
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout ${{ inputs.branch }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
- name: Install fastlane
run: gem install fastlane -v 2.227.1
- name: Trigger Deploy Flipcash
env:
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
ASC_KEY_CONTENT: ${{ secrets.ASC_KEY_CONTENT }}
APP_IDENTIFIER: ${{ secrets.APP_IDENTIFIER }}
GROUP_SECRET: ${{ secrets.TESTFLIGHT_GROUP }}
BRANCH: ${{ inputs.branch }}
GROUP_INPUT: ${{ inputs.group }}
NOTES_INPUT: ${{ inputs.notes }}
WAIT: ${{ inputs.wait }}
run: |
set -euo pipefail
args=(branch:"$BRANCH" wait:"$WAIT")
# "What to Test" is set on the finished build via the App Store Connect
# API, so it needs the wait. A one-line dispatch input carries line
# breaks as literal \n — expand them into a file the lane reads.
if [ -n "$NOTES_INPUT" ]; then
printf '%b\n' "$NOTES_INPUT" > "$RUNNER_TEMP/what-to-test.txt"
args+=(notes_file:"$RUNNER_TEMP/what-to-test.txt")
fi
# blank input -> use the TESTFLIGHT_GROUP secret (auto-assign)
# "none" -> trigger only, assign nothing
# any name -> one-off override of the secret
group_lc=$(printf '%s' "$GROUP_INPUT" | tr '[:upper:]' '[:lower:]')
case "$group_lc" in
none) ;;
"") [ -n "$GROUP_SECRET" ] && args+=(group:"$GROUP_SECRET") ;;
*) args+=(group:"$GROUP_INPUT") ;;
esac
fastlane deploy "${args[@]}"