-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[No QA] Callable buildIOS workflow #50123
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d905009
Save draft state
roryabraham 15a61d7
Finish buildIOS workflow
roryabraham 562be33
Use callable workflow in deploy.yml
roryabraham 00a17ef
Use callable ios workflow in testBuild
roryabraham c43831e
exportS3Path singular
roryabraham 3bf805d
Fix upload step
roryabraham ae65b87
Fix typo in Fastfile
roryabraham 2db0222
Update buildIOS with AdHoc-specific steps
roryabraham 2de022b
Make pull_request_number type: string to make lint happy
roryabraham d3c38d9
Add missing workflow-level outputs
roryabraham cf033ca
Fix needs
roryabraham 6bdeb2c
Don't access env where it's not available
roryabraham 8deb907
Debug provisioning profile stuff
roryabraham 346359e
Correctly expand provisioningProfile variable
roryabraham d4bf58a
Remove spaces from .ipa file names
roryabraham d0126f4
Fix typo in Fastfile
roryabraham 1a100d1
dsym not dysm
roryabraham c0bd145
Don't announce failed ios build
roryabraham adbc4b2
Upload jsbundle sourcemaps
roryabraham bcb43d5
Fix ipa path
roryabraham 0e59102
Standardize and fix workflow artifacts, correctly upload to release
roryabraham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
name: Build iOS app | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
type: | ||
description: 'What type of build to run. Must be one of ["release", "adhoc"]' | ||
type: string | ||
required: true | ||
ref: | ||
description: Git ref to checkout and build | ||
type: string | ||
required: true | ||
pull_request_number: | ||
description: The pull request number associated with this build, if relevant. | ||
type: string | ||
required: false | ||
outputs: | ||
IPA_FILE_NAME: | ||
value: ${{ jobs.build.outputs.IPA_FILE_NAME }} | ||
DSYM_FILE_NAME: | ||
value: ${{ jobs.build.outputs.DSYM_FILE_NAME }} | ||
|
||
workflow_dispatch: | ||
inputs: | ||
type: | ||
description: What type of build do you want to run? | ||
required: true | ||
type: choice | ||
options: | ||
- release | ||
- adhoc | ||
ref: | ||
description: Git ref to checkout and build | ||
required: true | ||
type: string | ||
pull_request_number: | ||
description: The pull request number associated with this build, if relevant. | ||
type: number | ||
required: false | ||
|
||
jobs: | ||
build: | ||
name: Build iOS app | ||
runs-on: macos-13-xlarge | ||
env: | ||
DEVELOPER_DIR: /Applications/Xcode_15.2.0.app/Contents/Developer | ||
outputs: | ||
IPA_FILE_NAME: ${{ steps.build.outputs.IPA_FILE_NAME }} | ||
DSYM_FILE_NAME: ${{ steps.build.outputs.DSYM_FILE_NAME }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Create .env.adhoc file based on staging and add PULL_REQUEST_NUMBER env to it | ||
if: ${{ inputs.type == 'adhoc' }} | ||
run: | | ||
cp .env.staging .env.adhoc | ||
sed -i '' 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc | ||
echo "PULL_REQUEST_NUMBER=${{ inputs.pull_request_number }}" >> .env.adhoc | ||
|
||
- name: Configure MapBox SDK | ||
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} | ||
|
||
- name: Setup Node | ||
id: setup-node | ||
uses: ./.github/actions/composite/setupNode | ||
|
||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1.190.0 | ||
with: | ||
bundler-cache: true | ||
|
||
- name: Cache Pod dependencies | ||
uses: actions/cache@v4 | ||
id: pods-cache | ||
with: | ||
path: ios/Pods | ||
key: ${{ runner.os }}-pods-cache-${{ hashFiles('ios/Podfile.lock', 'firebase.json') }} | ||
|
||
- name: Compare Podfile.lock and Manifest.lock | ||
id: compare-podfile-and-manifest | ||
run: echo "IS_PODFILE_SAME_AS_MANIFEST=${{ hashFiles('ios/Podfile.lock') == hashFiles('ios/Pods/Manifest.lock') }}" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Install cocoapods | ||
uses: nick-fields/retry@3f757583fb1b1f940bc8ef4bf4734c8dc02a5847 | ||
if: steps.pods-cache.outputs.cache-hit != 'true' || steps.compare-podfile-and-manifest.outputs.IS_PODFILE_SAME_AS_MANIFEST != 'true' || steps.setup-node.outputs.cache-hit != 'true' | ||
with: | ||
timeout_minutes: 10 | ||
max_attempts: 5 | ||
command: scripts/pod-install.sh | ||
|
||
- name: Decrypt provisioning profiles | ||
run: | | ||
cd ios | ||
provisioningProfile='' | ||
if [ '${{ inputs.type }}' == 'release' ]; then | ||
provisioningProfile='NewApp_AppStore' | ||
else | ||
provisioningProfile='NewApp_AdHoc' | ||
fi | ||
echo "Using provisioning profile: $provisioningProfile" | ||
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output "$provisioningProfile.mobileprovision" "$provisioningProfile.mobileprovision.gpg" | ||
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output "${provisioningProfile}_Notification_Service.mobileprovision" "${provisioningProfile}_Notification_Service.mobileprovision.gpg" | ||
env: | ||
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} | ||
|
||
- name: Decrypt code signing certificate | ||
run: cd ios && gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output Certificates.p12 Certificates.p12.gpg | ||
env: | ||
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} | ||
|
||
- name: Build iOS ${{ inputs.type }} app | ||
id: build | ||
run: | | ||
lane='' | ||
if [ '${{ inputs.type }}' == 'release' ]; then | ||
lane='build' | ||
else | ||
lane='build_adhoc' | ||
fi | ||
|
||
bundle exec fastlane ios "$lane" | ||
|
||
# Reload environment variables from GITHUB_ENV | ||
# shellcheck disable=SC1090 | ||
source "$GITHUB_ENV" | ||
|
||
{ | ||
# ipaPath and dsymPath are environment variables set within the Fastfile | ||
echo "IPA_PATH=$ipaPath" | ||
echo "IPA_FILE_NAME=$(basename "$ipaPath")" | ||
echo "DSYM_PATH=$dsymPath" | ||
echo "DSYM_FILE_NAME=$(basename "$dsymPath")" | ||
} >> "$GITHUB_OUTPUT" | ||
|
||
- name: Upload iOS build artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ios-artifact-ipa | ||
path: ${{ steps.build.outputs.IPA_PATH }} | ||
|
||
- name: Upload iOS debug symbols artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ios-artifact-dsym | ||
path: ${{ steps.build.outputs.DSYM_PATH }} | ||
|
||
- name: Upload iOS sourcemaps | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ios-artifact-sourcemaps | ||
path: ./main.jsbundle.map |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it have
${ }
like below?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not necessary - the
${ }
is only necessary because_
is a potentially valid character in a bash variable. So when bash tries to expand the variable, it looks for a variable calledprovisioningProfile_Notification_Service
, which does not exist. That's why we have the explicit brackets there.Definitely a kind of quirky bash thing, but to be consistent about always using
${ }
to expand variables in strings would mean changes in a lot of places.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one def tripped me up