ci: adopt local EAS build pattern with Android SDK, artifact upload, and release
This commit is contained in:
@@ -1,32 +1,90 @@
|
||||
name: Build Android APK
|
||||
name: CodexBar Mobile Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
paths:
|
||||
- '**/*.ts'
|
||||
- '**/*.tsx'
|
||||
- '**/*.js'
|
||||
- '**/*.json'
|
||||
- '.gitea/workflows/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-android:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 20
|
||||
node-version: 22
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci --legacy-peer-deps
|
||||
- name: 🏗 Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 17
|
||||
|
||||
- name: Setup EAS
|
||||
- name: 🏗 Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: 🏗 Setup Expo and EAS
|
||||
uses: expo/expo-github-action@v8
|
||||
with:
|
||||
eas-version: latest
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
eas-version: latest
|
||||
packager: npm
|
||||
|
||||
- name: Build Android APK
|
||||
run: eas build --platform android --profile preview --non-interactive
|
||||
- name: 📦 Install dependencies
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: 👷 Build app
|
||||
run: |
|
||||
eas build --local \
|
||||
--non-interactive \
|
||||
--output=./app-build \
|
||||
--platform=android \
|
||||
--profile=preview
|
||||
|
||||
- name: 📝 Rename build to APK
|
||||
run: mv app-build codexbar-release.apk
|
||||
|
||||
- name: 📤 Upload build artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: codexbar-android-preview-build
|
||||
path: codexbar-release.apk
|
||||
if-no-files-found: error
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-android]
|
||||
steps:
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 📥 Download Android artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: codexbar-android-preview-build
|
||||
|
||||
- name: 🏷 Create tag
|
||||
run: |
|
||||
TAG="codexbar-build-$(git rev-parse --short HEAD)"
|
||||
git tag "$TAG"
|
||||
git push origin "$TAG"
|
||||
echo "RELEASE_TAG=$TAG" >> $GITHUB_ENV
|
||||
|
||||
- name: 🚀 Create release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ env.RELEASE_TAG }}
|
||||
name: ${{ env.RELEASE_TAG }}
|
||||
files: codexbar-release.apk
|
||||
generate_release_notes: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user