Skip to content

Build Android APK

Build Android APK #462

Workflow file for this run

name: Build Android APK
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true # Move this here
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.26.1
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Install Expo packages
working-directory: artifacts/novel-reader
run: pnpm add expo-file-system expo-sharing @sentry/react-native && pnpm install --no-frozen-lockfile
- name: Setup Expo and EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Initialize EAS project
working-directory: artifacts/novel-reader
run: eas init --non-interactive --force
- name: Build Android APK
working-directory: artifacts/novel-reader
run: eas build --platform android --profile preview --non-interactive --local
env:
APP_BUILD_NUMBER: ${{ github.run_number }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
# The EAS local build repackages the project into a fresh sandbox,
# so the sentry-cli we install earlier in this job never makes it
# there. Skip the build-time source map upload rather than chase
# that — native crash capture at runtime is unaffected, this only
# means JS stack traces in Sentry stay minified for now.
SENTRY_DISABLE_AUTO_UPLOAD: "true"
- name: Rename and Move APK
working-directory: artifacts/novel-reader
run: |
VERSION=$(node -p "require('./package.json').version")
REV=${{ github.run_number }}
mkdir -p ../../dist
APK_FILE=$(find . -maxdepth 1 -name "*.apk" -type f | head -n 1)
cp "$APK_FILE" "../../dist/NovelDR v${VERSION}rev${REV}.apk"
echo "Build Complete: NovelDR v${VERSION}rev${REV}.apk"
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: NovelDR-Build-${{ github.run_number }}
path: dist/*.apk
if-no-files-found: error