-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: create simulator build when label is added to PR
- Loading branch information
1 parent
a5b7e40
commit c83076b
Showing
3 changed files
with
134 additions
and
25 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: EAS deploy | ||
description: Run EAS deploy | ||
inputs: | ||
EXPO_TOKEN: # id of input | ||
description: 'Expo token' | ||
required: true | ||
APPLE_ID: | ||
description: 'Apple ID' | ||
required: true | ||
ASC_APP_ID: | ||
description: 'ASC App ID' | ||
required: true | ||
EXPO_APPLE_APP_SPECIFIC_PASSWORD: | ||
description: 'Expo Apple app specific password' | ||
required: true | ||
LEATHER_BOT: | ||
description: 'GH bot token' | ||
required: true | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Prepare the app | ||
uses: ./.github/actions/provision | ||
- name: Extract branch name | ||
shell: bash | ||
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | ||
id: extract_branch | ||
- name: Setup Expo and EAS | ||
uses: expo/expo-github-action@v8 | ||
with: | ||
eas-version: latest | ||
token: ${{ inputs.EXPO_TOKEN }} | ||
- name: Install jq tool | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install jq | ||
shell: bash | ||
- name: Setup eas credentials | ||
run: | | ||
echo $(jq --arg APPLE_ID "$APPLE_ID" '.submit.production.ios.appleId = $APPLE_ID' ./apps/mobile/eas.json) > ./apps/mobile/eas.json | ||
echo $(jq --arg ASC_APP_ID "$ASC_APP_ID" '.submit.production.ios.ascAppId = $ASC_APP_ID' ./apps/mobile/eas.json) > ./apps/mobile/eas.json | ||
shell: bash | ||
env: | ||
APPLE_ID: ${{ inputs.APPLE_ID }} | ||
ASC_APP_ID: ${{ inputs.ASC_APP_ID }} | ||
# Wait for build to either succeed or fail | ||
- name: 🛫 Build for simulator 🛫 | ||
id: simulator_build | ||
run: | | ||
cd apps/mobile | ||
if [[ "$BRANCH_NAME" == "dev" ]] | ||
then | ||
# No wait on simulator version build of the app if we are on a dev branch | ||
eas build --platform ios --profile=simulator --non-interactive --no-wait | ||
else | ||
# set temporary command output | ||
setTmpOutput () { tee /tmp/capture.out; } | ||
# get temporary command output | ||
getTmpOutput () { cat /tmp/capture.out; } | ||
eas build --platform ios --profile=simulator --non-interactive | setTmpOutput | ||
# Last line of the build output is the link to the expo build | ||
UNSAFE_BUILD_LINK=$(getTmpOutput | tail -n 1) | ||
if [[ $UNSAFE_BUILD_LINK == *"https://expo.dev/accounts/leather-wallet/projects/leather-wallet-mobile/builds/"* ]]; then | ||
echo "Found build link!" | ||
echo "BUILD_LINK=$UNSAFE_BUILD_LINK" >> $GITHUB_OUTPUT | ||
else | ||
echo "No build link!" | ||
fi | ||
fi | ||
shell: bash | ||
env: | ||
EXPO_APPLE_APP_SPECIFIC_PASSWORD: ${{ inputs.EXPO_APPLE_APP_SPECIFIC_PASSWORD }} | ||
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} | ||
- name: Publish simulator expo link in PR | ||
if: ${{ steps.extract_branch.outputs.branch != 'dev' }} | ||
uses: actions/github-script@v7 | ||
env: | ||
BUILD_LINK: ${{ steps.simulator_build.outputs.BUILD_LINK }} | ||
with: | ||
github-token: ${{ inputs.LEATHER_BOT }} | ||
script: | | ||
const { BUILD_LINK } = process.env | ||
if(BUILD_LINK) { | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: "Expo simulator build link: " + BUILD_LINK | ||
}) | ||
} | ||
- name: 🛫 Build for production 🛫 | ||
if: ${{ steps.extract_branch.outputs.branch == 'dev' }} | ||
run: | | ||
cd apps/mobile | ||
# Release version of the app, we should wait for it to see the result | ||
eas build --platform ios --profile=production --non-interactive --auto-submit | ||
shell: bash | ||
env: | ||
EXPO_APPLE_APP_SPECIFIC_PASSWORD: ${{ inputs.EXPO_APPLE_APP_SPECIFIC_PASSWORD }} |
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,25 @@ | ||
on: | ||
pull_request: | ||
types: | ||
- synchronize | ||
- labeled | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
name: trigger EAS deploy | ||
|
||
jobs: | ||
deploy-eas: | ||
if: contains(github.event.pull_request.labels.*.name, 'needs:demo-build') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/eas-deploy | ||
with: | ||
EXPO_APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.EXPO_APPLE_APP_SPECIFIC_PASSWORD }} | ||
APPLE_ID: ${{ secrets.APPLE_ID }} | ||
ASC_APP_ID: ${{ secrets.ASC_APP_ID }} | ||
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} | ||
LEATHER_BOT: ${{ secrets.LEATHER_BOT }} |
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