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:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
workflow_dispatch:
|
paths:
|
||||||
|
- '**/*.ts'
|
||||||
|
- '**/*.tsx'
|
||||||
|
- '**/*.js'
|
||||||
|
- '**/*.json'
|
||||||
|
- '.gitea/workflows/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-android:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: 🏗 Setup repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: 🏗 Setup Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 22
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: 🏗 Setup Java
|
||||||
run: npm ci --legacy-peer-deps
|
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
|
uses: expo/expo-github-action@v8
|
||||||
with:
|
with:
|
||||||
eas-version: latest
|
|
||||||
token: ${{ secrets.EXPO_TOKEN }}
|
token: ${{ secrets.EXPO_TOKEN }}
|
||||||
|
eas-version: latest
|
||||||
packager: npm
|
packager: npm
|
||||||
|
|
||||||
- name: Build Android APK
|
- name: 📦 Install dependencies
|
||||||
run: eas build --platform android --profile preview --non-interactive
|
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