feat: add CI/CD workflows and EAS build config (Sprint 5)
Some checks are pending
Build (EAS) / EAS Build (Android Preview APK) (push) Waiting to run

This commit is contained in:
root
2026-02-19 22:08:36 +08:00
parent c8fe67f346
commit 6a4ee9e80f
5 changed files with 199 additions and 2 deletions

103
BUILDING.md Normal file
View File

@@ -0,0 +1,103 @@
# Building TerritoryLog with EAS
This document explains how to build TerritoryLog APKs and production bundles using **Expo Application Services (EAS)**.
---
## Prerequisites
### 1. Install EAS CLI
```bash
npm install -g eas-cli
```
Verify installation:
```bash
eas --version
# Should output >= 12.0.0
```
### 2. Log in to Expo Account
```bash
eas login
```
You will be prompted for your Expo username and password. If you don't have an account, create one at [https://expo.dev](https://expo.dev).
---
## Building
### Preview Build (APK — for internal testing)
This generates a standard `.apk` file that can be installed directly on Android devices without the Play Store.
```bash
eas build --platform android --profile preview
```
Once the build completes, EAS will provide a download URL for the APK.
### Production Build (AAB — for Play Store submission)
This generates an `.aab` (Android App Bundle) optimized for Play Store distribution.
```bash
eas build --platform android --profile production
```
### Development Build (for local development with Expo Go replacement)
```bash
eas build --platform android --profile development
```
---
## About Keystores
> **EAS manages keystores automatically.** On your first build, EAS will generate and securely store a keystore on Expo's servers. You don't need to manually create or manage a keystore. If you need to use an existing keystore, see the [EAS credentials documentation](https://docs.expo.dev/app-signing/managed-credentials/).
---
## CI/CD — Setting Up `EXPO_TOKEN` in Gitea
The CI/CD pipeline in `.gitea/workflows/build.yml` requires an `EXPO_TOKEN` secret to authenticate with EAS without interactive login.
### Steps to set up:
1. **Generate an Expo access token:**
- Go to [https://expo.dev/accounts/\[your-username\]/settings/access-tokens](https://expo.dev/accounts/)
- Click **"Create Token"**
- Name it something like `gitea-ci` and copy the token value
2. **Add the secret to Gitea:**
- In this repo, go to **Settings → Actions → Secrets**
- Click **"Add Secret"**
- Name: `EXPO_TOKEN`
- Value: *(paste your token)*
- Click **"Save"**
3. The `build.yml` workflow will now authenticate automatically when triggered by a push to `main`.
---
## Build Profiles Summary
| Profile | Output | Distribution | Use Case |
|---------------|----------|--------------|------------------------------|
| `development` | APK | Internal | Dev client for local testing |
| `preview` | APK | Internal | QA / internal testing |
| `production` | AAB | Play Store | Public release |
---
## Useful Links
- [EAS Build documentation](https://docs.expo.dev/build/introduction/)
- [EAS CLI reference](https://docs.expo.dev/eas-cli/)
- [Android app signing with EAS](https://docs.expo.dev/app-signing/managed-credentials/)
- [Expo access tokens](https://docs.expo.dev/accounts/programmatic-access/)