-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (135 loc) · 5.34 KB
/
build-staging-ios.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
name: Build staging iOS project
on:
workflow_dispatch:
inputs:
force-build:
description: 'Forces a new build and ignores the cache'
required: false
type: choice
default: false
options:
- true
- false
push:
branches:
- master
- release/**
jobs:
build-ios:
name: Build iOS
strategy:
fail-fast: false
matrix:
org: [atb, nfk, fram, troms]
environment: ${{ matrix.org }}
timeout-minutes: 360
runs-on: macOS-13
env:
KEYCHAIN_NAME: "CI"
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Add Entur private registry credentials
run: sh ./scripts/add-entur-private-registry.sh
env:
ENTUR_REGISTRY_USER: ${{ vars.ENTUR_REGISTRY_USER }}
ENTUR_REGISTRY_TOKEN: ${{ secrets.ENTUR_REGISTRY_TOKEN }}
- name: Setup build dependencies, environment and assets
uses: ./.github/actions/ios-build-setup
with:
use-build-cache: 'true'
app-environment: 'staging'
app-org: ${{ matrix.org }}
git-crypt-key: ${{ secrets.GIT_CRYPT_KEY }}
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.MATCH_SSH_PRIVATE_KEY }}
- name: Get potential cached ipa & dsym
uses: actions/cache@v3
id: ipa-cache
with:
path: |
AtB.ipa
AtB.app.dSYM.zip
key: ${{ matrix.org }}-${{ runner.os }}-ios-cache-${{ hashFiles('ios/**') }}-${{ hashFiles('.yalc/**') }}-${{ hashFiles('.env') }}-${{ hashFiles('assets/') }}
- name: Generate native assets
if: inputs.force-build == 'true' || steps.ipa-cache.outputs.cache-hit != 'true'
run: |
rm '/usr/local/bin/2to3'
rm '/usr/local/bin/2to3-3.12'
rm '/usr/local/bin/idle3'
rm '/usr/local/bin/idle3.12'
rm '/usr/local/bin/pydoc3'
rm '/usr/local/bin/pydoc3.12'
rm '/usr/local/bin/python3'
rm '/usr/local/bin/python3-config'
rm '/usr/local/bin/python3.12'
rm '/usr/local/bin/python3.12-config'
rm '/usr/local/bin/2to3-3.11'
rm '/usr/local/bin/idle3.11'
rm '/usr/local/bin/pydoc3.11'
rm '/usr/local/bin/python3.11'
rm '/usr/local/bin/python3.11-config'
brew install imagemagick
yarn generate-native-assets
- name: Disable widget
if: ${{ env.ENABLE_WIDGET != 'true' }}
run: bundle exec configure_extensions remove ios/atb.xcodeproj app departureWidget AtbAppIntent
- name: Remove use of beacons
if: ${{ env.KETTLE_API_KEY == '' }}
run: bundle exec fastlane ios remove_use_of_beacons
- name: Run fastlane cert match
if: inputs.force-build == 'false' || steps.ipa-cache.outputs.cache-hit == 'true'
run: bundle exec fastlane ios get_certs
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
KEYCHAIN_NAME: ${{ env.KEYCHAIN_NAME }}
- name: Run fastlane build
if: inputs.force-build == 'true' || steps.ipa-cache.outputs.cache-hit != 'true'
run: bundle exec fastlane ios build
env:
# A workaround for Github Actions which breaks for a timeout in some cases,
# so this sets a higher value for TIMEOUT and reduces the number of retries
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 180
FASTLANE_XCODEBUILD_SETTINGS_RETRIES: 1
EXPORT_METHOD: 'ad-hoc'
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
KEYCHAIN_NAME: ${{ env.KEYCHAIN_NAME }}
- name: Replace ipa bundle
if: inputs.force-build == 'false' || steps.ipa-cache.outputs.cache-hit == 'true'
run: sh ./scripts/ios/replace-bundle.sh
env:
IPA_FILE_NAME: 'AtB.ipa'
APP_NAME: 'AtB.app'
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
KEYCHAIN_NAME: ${{ env.KEYCHAIN_NAME }}
- name: Distribute to Firebase App Distribution
if: matrix.org != 'atb'
run: |
echo ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIALS}} | base64 --decode > google-services.json
bundle exec fastlane ios firebase_distribution_staging
env:
GCP_CREDENTIALS_PATH: google-services.json
FIREBASE_APP_ID_IOS: ${{ secrets.FIREBASE_APP_ID_IOS }}
- name: Distribute to AppCenter
if: matrix.org == 'atb'
run: bundle exec fastlane ios appcenter_staging
env:
APPCENTER_API_KEY: ${{ secrets.APPCENTER_IOS_API_KEY }}
- name: Create bundle and source maps
if: inputs.force-build == 'true' || steps.ipa-cache.outputs.cache-hit != 'true'
run: sh ./scripts/ios/create-sourcemaps.sh
- name: Upload bundle and source maps
run: sh ./scripts/ios/upload-sourcemaps.sh
env:
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
- name: Upload dSYMs
if: inputs.force-build == 'true' || steps.ipa-cache.outputs.cache-hit != 'true'
run: sh ./scripts/ios/upload-dsyms.sh
env:
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
- name: Register app version
run: sh ./scripts/ios/register-app-version.sh
env:
ENTUR_PUBLISH_CLIENT: ${{ secrets.ABT_ENTUR_PUBLISH_CLIENT_STAGING}}