Build App #5
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
# References: | |
# https://github.com/thomasread99/expo-workflows/ | |
name: Build App | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
type: string | |
description: 'Ref to Build' | |
required: true | |
submit: | |
type: boolean | |
description: 'Submit?' | |
required: false | |
release: | |
type: boolean | |
description: 'Release?' | |
required: false | |
jobs: | |
build-android: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup repo | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.USTHING_GITHUB_TOKEN }} | |
ref: ${{ inputs.ref }} | |
repository: USThing/USThingApp | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
- name: Setup Corepack | |
run: | | |
corepack enable | |
corepack install | |
- name: Setup Yarn Cache | |
uses: actions/setup-node@v4 | |
with: | |
cache: yarn | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: microsoft | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Setup Expo and EAS | |
uses: expo/expo-github-action@v8 | |
with: | |
token: ${{ secrets.EXPO_TOKEN }} | |
expo-version: latest | |
eas-version: latest | |
- name: Install Dependencies | |
run: yarn | |
- name: Build | |
run: eas build --profile production --platform android --local --non-interactive --output=${{ github.workspace }}/usthing-preview.aab | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: preview | |
path: ${{ github.workspace }}/usthing-preview.apk | |
# https://docs.expo.dev/submit/ios/#submitting-your-app-using-ci | |
- name: Submit to TestFlight | |
if: ${{ inputs.submit == true }} | |
run: eas submit --profile production --platform android --non-interactive --path ${{ github.workspace }}/usthing-preview.aab | |
build-ios: | |
runs-on: macos-latest | |
steps: | |
- name: Setup repo | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.USTHING_GITHUB_TOKEN }} | |
ref: ${{ inputs.ref }} | |
repository: USThing/USThingApp | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
- name: Setup Corepack | |
run: | | |
corepack enable | |
corepack install | |
- name: Setup Yarn Cache | |
uses: actions/setup-node@v4 | |
with: | |
cache: yarn | |
- name: Setup Expo | |
uses: expo/expo-github-action@v8 | |
with: | |
expo-version: latest | |
eas-version: latest | |
token: ${{ secrets.EXPO_TOKEN }} | |
- name: Install Dependencies | |
run: yarn | |
- name: Build iOS App | |
run: eas build --profile production --platform ios --local --non-interactive --output ${{ github.workspace }}/usthing-preview.ipa | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: preview | |
path: ${{ github.workspace }}/usthing-preview.ipa | |
# https://docs.expo.dev/submit/ios/#submitting-your-app-using-ci | |
- name: Submit to TestFlight | |
if: ${{ inputs.submit == true }} | |
run: eas submit --profile production --platform ios --non-interactive --path ${{ github.workspace }}/usthing-preview.ipa | |
build-android-apk: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup repo | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.USTHING_GITHUB_TOKEN }} | |
ref: ${{ inputs.ref }} | |
repository: USThing/USThingApp | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
- name: Setup Corepack | |
run: | | |
corepack enable | |
corepack install | |
- name: Setup Yarn Cache | |
uses: actions/setup-node@v4 | |
with: | |
cache: yarn | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: microsoft | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Setup Expo and EAS | |
uses: expo/expo-github-action@v8 | |
with: | |
token: ${{ secrets.EXPO_TOKEN }} | |
expo-version: latest | |
eas-version: latest | |
- name: Install Dependencies | |
run: yarn | |
- name: Build | |
run: eas build --profile production:apk --platform android --local --non-interactive --output=${{ github.workspace }}/usthing.apk | |
- name: Setup jq | |
uses: dcarbone/install-jq-action@v2 | |
- name: Submit to Production Server | |
if: ${{ inputs.release == true }} | |
run: | | |
curl -X 'POST' \ | |
'https://static.api.usthing.xyz/v1/apk/latest' \ | |
-H 'Authorization: Bearer ${{ secrets.ANDROID_APK_RELEASE_KEY }}' \ | |
-H 'Content-Type: multipart/form-data' \ | |
-F 'apk=@${{ github.workspace }}/usthing.apk' | |
- name: Submit Version to Production Server | |
if: ${{ inputs.release == true }} | |
run: | | |
curl -X 'POST' \ | |
'https://static.api.usthing.xyz/v1/apk/latest/version' \ | |
-H 'Authorization: Bearer ${{ secrets.ANDROID_APK_RELEASE_KEY }}' \ | |
-H 'Content-Type: application/json' \ | |
--data '$(jq '.expo.version' app.json)' |