This repository has been archived by the owner on Jun 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
168 lines (159 loc) · 6.28 KB
/
Prototype.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
name: Prototype
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
type: string
required: false
bumpBuildNumber:
description: 'Bump build number'
type: boolean
required: true
default: true
jobs:
dependencies:
runs-on: [self-hosted, ARM64]
steps:
- name: Ensure not on main branch
run: |
echo "Ensuring current branch $GITHUB_REF is not 'main' branch…"
[[ "$GITHUB_REF" != "refs/heads/main" ]]
- name: Setup shell
run: |
eval "$(rbenv init -)"
eval "$(/opt/homebrew/bin/brew shellenv)"
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Restore dependencies
uses: actions/cache@v3
id: cache-dependencies
env:
cache-name: cache-dependencies
with:
path: |
vendor
.bundle
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('Gemfile.lock', 'Brewfile') }}
- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: bundle install
- name: Brew bundle
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: ./native_arch.sh brew bundle --no-lock
bumpVersion:
runs-on: [self-hosted, ARM64]
needs: dependencies
outputs:
gitTag: ${{ steps.gitTag.outputs.gitTag }}
steps:
- name: Setup shell
run: |
eval "$(rbenv init -)"
eval "$(/opt/homebrew/bin/brew shellenv)"
- name: Check out repository code
uses: actions/checkout@v3
- name: Restore dependencies
uses: actions/cache/restore@v3
id: cache-dependencies
env:
cache-name: cache-dependencies
with:
path: |
vendor
.bundle
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('Gemfile.lock', 'Brewfile') }}
fail-on-cache-miss: true
- name: fastlane bump version and create tag
env:
VERSION: ${{ inputs.version }}
BUMP_BUILD_NUMBER: ${{ inputs.bumpBuildNumber }}
GITHUB_ENV: ${{ env.GITHUB_ENV }}
run: |
export LANG=en_US.UTF-8;
export LANGUAGE=en_US:en;
bundle exec fastlane bumpVersion
- name: Export git tag
id: gitTag
env:
VERSION: ${{ env.GIT_TAG }}
run: echo "::set-output name=gitTag::${{ env.GIT_TAG }}"
prototype:
runs-on: [self-hosted, ARM64]
needs: bumpVersion
steps:
- name: Setup shell
run: |
eval "$(rbenv init -)"
eval "$(/opt/homebrew/bin/brew shellenv)"
- name: Check out repository code
uses: actions/checkout@v3
with:
ref: ${{ needs.bumpVersion.outputs.gitTag }}
- name: Restore dependencies
uses: actions/cache/restore@v3
id: cache-dependencies
env:
cache-name: cache-dependencies
with:
path: |
vendor
.bundle
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('Gemfile.lock', 'Brewfile') }}
fail-on-cache-miss: true
- name: Install the Apple certificate and provisioning profile
env:
DISTRIBUTION_CERTIFICATE_P12_BASE64: ${{ secrets.DISTRIBUTION_CERTIFICATE_P12_BASE64 }}
DISTRIBUTION_CERTIFICATE_P12_PASSWORD: ${{ secrets.DISTRIBUTION_CERTIFICATE_P12_PASSWORD }}
PROTOTYPE_DISTRIBUTION_PROVISIONING_PROFILE_BASE64: ${{ secrets.PROTOTYPE_DISTRIBUTION_PROVISIONING_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
APPSTORECONNECT_API_KEY_JSON: ${{ secrets.APPSTORECONNECT_API_KEY_JSON }}
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
APPSTORECONNECT_API_KEY_PATH=$RUNNER_TEMP/api_key.json
# import certificate and provisioning profile from secrets
echo -n "$DISTRIBUTION_CERTIFICATE_P12_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$PROTOTYPE_DISTRIBUTION_PROVISIONING_PROFILE_BASE64" | base64 --decode -o $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 fastlane/AppleWWDRCAG3.cer -A -t cert -k $KEYCHAIN_PATH
security import $CERTIFICATE_PATH -P "$DISTRIBUTION_CERTIFICATE_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
echo -n "$APPSTORECONNECT_API_KEY_JSON" > $APPSTORECONNECT_API_KEY_PATH
echo "KEYCHAIN_PATH=$KEYCHAIN_PATH" >> $GITHUB_ENV
echo "PP_PATH=$PP_PATH" >> $GITHUB_ENV
echo "APPSTORECONNECT_API_KEY_PATH=$APPSTORECONNECT_API_KEY_PATH" >> $GITHUB_ENV
- name: fastlane prototype testflight
env:
APPSTORECONNECT_API_KEY_PATH: ${{ env.APPSTORECONNECT_API_KEY_PATH }}
KEYCHAIN_PATH: ${{ env.KEYCHAIN_PATH }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
PP_PATH: ${{ env.PP_PATH }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: |
export LANG=en_US.UTF-8;
export LANGUAGE=en_US:en;
bundle exec fastlane preview
- name: Upload xcarchive
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: BundesIdent-Preview.xcarchive.zip
path: artifacts/*.xcarchive.zip
if-no-files-found: error
- name: Clean up keychain and provisioning profile
if: ${{ always() }}
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision