chore: 简化 Expo 本地构建工作流,移除 Java 安装步骤并更新依赖安装方式
Some checks failed
/ build (push) Failing after 2m25s

This commit is contained in:
2025-08-14 16:07:44 +08:00
parent 038789a50e
commit aea78f2f79

View File

@@ -1,63 +1,28 @@
name: Expo Local Build APK
on: on:
push: push:
branches: branches:
- master - master
workflow_dispatch:
jobs: jobs:
build-apk: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
steps: steps:
- name: Checkout code - name: 🏗 Setup repo
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Setup Node.js - name: 🏗 Setup Node
uses: actions/setup-node@v4 uses: actions/setup-node@v3
with: with:
node-version: '18' node-version: 18.x
cache: yarn
- name: Install Java 17 - name: 🏗 Setup EAS
run: | uses: expo/expo-github-action@v8
# 首先更新包列表
sudo apt update
# 安装 OpenJDK 17
sudo apt install -y openjdk-17-jdk
# 验证安装
java -version
javac -version
# 设置 JAVA_HOME 环境变量
JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
echo "PATH=$JAVA_HOME/bin:$PATH" >> $GITHUB_ENV
# 验证环境变量
echo "Java Home: $JAVA_HOME"
- name: Setup pnpm
uses: pnpm/action-setup@v2
with: with:
version: latest eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Install Expo CLI & EAS CLI - name: 📦 Install dependencies
run: pnpm add -g expo-cli eas-cli run: yarn install
- name: Install dependencies - name: 🚀 Build app
run: pnpm install --frozen-lockfile run: eas build --non-interactive
# 本地打包
- name: EAS Local Build APK
run: eas build -p android --local --output=dist/app.apk
# 上传产物
- name: Upload APK to Release
uses: actions/upload-artifact@v3
with:
name: app-apk
path: dist/app.apk