Skip to content

EAS - Build Android #26

EAS - Build Android

EAS - Build Android #26

name: EAS - Build Android
on:
workflow_dispatch:
inputs:
dev:
description: "HPAPP_CONFIG_NAME=dev"
required: false
type: boolean
default: false
beta:
description: "HPAPP_CONFIG_NAME=beta"
required: false
type: boolean
default: false
prod:
description: "HPAPP_CONFIG_NAME=prod"
required: false
type: boolean
default: false
env:
NODE_VERSION: 22.3.0
EAS_VERSION: 13.4.2
JAVA_VERSION: 17
jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
target: ${{ steps.generatematrix.outputs.target }}
steps:
- id: generatematrix
run: |
inputs='${{ toJson(github.event.inputs) }}'
targets=()
for key in $(echo "$inputs" | jq -r 'keys[]'); do
if [ "$(echo "$inputs" | jq -r ".\"$key\"")" == "true" ]; then
targets+=("$key")
fi
done
targets_str=$(printf ',"%s"' "${targets[@]}")
targets_str="[${targets_str:1}]"
echo "target=$targets_str" >> $GITHUB_OUTPUT
build:
needs: generate-matrix
strategy:
matrix:
target: ${{ fromJson(needs.generate-matrix.outputs.target) }}
runs-on: ubuntu-latest
environment:
name: eas-${{ matrix.target }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
cache-dependency-path: "expo/package.json"
- uses: expo/expo-github-action@v8
with:
eas-version: ${{ env.EAS_VERSION }}
token: ${{ secrets.EXPO_TOKEN }}
- uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: "temurin"
- uses: android-actions/setup-android@v3
- run: cd expo && rm ./config/${{ matrix.target }}/.gitignore
- run: cd expo && yarn install
- run: cd expo && ./scripts/eas.sh build --profile ${{ matrix.target }} --platform android --local --output ./build/hpapp-${{ matrix.target }}.apk
if: ${{ matrix.target == 'dev' }}
env:
HPAPP_CONFIG_NAME: ${{ matrix.target }}
SECRETS_JSON: ${{ secrets.SECRETS_JSON }}
GOOGLE_SERVICES_INFO_PLIST: ${{ secrets.GOOGLE_SERVICES_INFO_PLIST }}
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
- run: cd expo && ./scripts/eas.sh build --profile ${{ matrix.target }} --platform android --local --output ./build/hpapp-${{ matrix.target }}.aab
if: ${{ matrix.target != 'dev' }}
env:
HPAPP_CONFIG_NAME: ${{ matrix.target }}
SECRETS_JSON: ${{ secrets.SECRETS_JSON }}
GOOGLE_SERVICES_INFO_PLIST: ${{ secrets.GOOGLE_SERVICES_INFO_PLIST }}
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
# [dev] upload artifacts
- uses: actions/upload-artifact@v4
if: ${{ matrix.target == 'dev' }}
with:
name: hpapp-${{ matrix.target }}.apk
path: ${{ github.workspace }}/expo/build/hpapp-${{ matrix.target }}.apk
# [beta/prod] upload artifacts
- run: cd expo && envsubst < ./config/eas.json.env > ./eas.json
if: ${{ matrix.target != 'dev' }}
env:
EAS_SUBMIT: ${{ secrets.EAS_SUBMIT }}