Skip to content

fix: restore CI by resolving dependency conflicts and cleaning lint/t… #70

fix: restore CI by resolving dependency conflicts and cleaning lint/t…

fix: restore CI by resolving dependency conflicts and cleaning lint/t… #70

Workflow file for this run

name: Build Android App

Check failure on line 1 in .github/workflows/build-android.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-android.yml

Invalid workflow file

(Line: 37, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.EXPO_TOKEN != '', (Line: 43, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.EXPO_TOKEN != ''
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
jobs:
build:
name: Build Android APK
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6.0.3
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 20.x
cache: 'npm'
- name: Setup Expo and EAS
uses: expo/expo-github-action@v9
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Install dependencies
run: npm ci
- name: Verify TypeScript
run: npx tsc --noEmit
- name: Setup EAS
if: ${{ secrets.EXPO_TOKEN != '' }}
run: |
# 配置 EAS
echo "EXPO_TOKEN=${{ secrets.EXPO_TOKEN }}" >> $GITHUB_ENV
- name: Build APK (Preview)
if: ${{ secrets.EXPO_TOKEN != '' }}
run: |
# 构建 Android 预览版 APK
eas build --platform android --profile preview --non-interactive --no-wait
env:
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
- name: Upload artifacts
uses: actions/upload-artifact@v7
if: always()
with:
name: build-artifacts
path: |
./
!node_modules
!.git
retention-days: 30
test-local:
name: Local Build Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6.0.3
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Verify TypeScript
run: npx tsc --noEmit
- name: Validate project structure
run: |
# Sanity check that the build target files actually exist before
# we spend EAS credits spinning up a cloud build.
for f in App.tsx app.json eas.json package.json src/shared/store/index.ts; do
if [ ! -f "$f" ]; then
echo "::error::missing required file: $f"
exit 1
fi
done
echo "project structure OK"
- name: Create test build report
run: |
echo "✅ 项目验证成功!" > build-report.txt
echo "📱 Todo App - 项目结构验证报告" >> build-report.txt
echo "日期: $(date)" >> build-report.txt
echo "Node版本: $(node --version)" >> build-report.txt
echo "npm版本: $(npm --version)" >> build-report.txt
- name: Upload build report
uses: actions/upload-artifact@v7
with:
name: build-report
path: build-report.txt
retention-days: 30