Skip to content
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

ci: eas deploy #464

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions .github/actions/eas-deploy/action.yml
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 }}
25 changes: 25 additions & 0 deletions .github/workflows/eas-deploy.yml
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 }}
29 changes: 4 additions & 25 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,31 +77,10 @@ jobs:
if: needs.release-please.outputs.releases_created
steps:
- uses: actions/checkout@v4
- name: Prepare the app
uses: ./.github/actions/provision
- name: Setup Expo and EAS
uses: expo/expo-github-action@v8
- uses: ./.github/actions/eas-deploy
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Install jq tool
run: |
sudo apt-get update
sudo apt-get install jq
- 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
env:
EXPO_APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.EXPO_APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
ASC_APP_ID: ${{ secrets.ASC_APP_ID }}
# Wait for build to either succeed or fail
- name: 🛫 Prepare for takeoff! 🛫
run: |
cd apps/mobile
# No wait on simulator version build of the app
eas build --platform ios --profile=simulator --non-interactive --no-wait
# Release version of the app, we should wait for it to see the result
eas build --platform ios --profile=production --non-interactive --auto-submit
env:
EXPO_APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.EXPO_APPLE_APP_SPECIFIC_PASSWORD }}
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
LEATHER_BOT: ${{ secrets.LEATHER_BOT }}
Loading