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
Some checks are pending
Build (EAS) / EAS Build (Android Preview APK) (push) Waiting to run
This commit is contained in:
37
.gitea/workflows/build.yml
Normal file
37
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Build (EAS)
|
||||
|
||||
# Triggered on push to main branch.
|
||||
# IMPORTANT: Set EXPO_TOKEN as a Gitea Actions secret before running this workflow.
|
||||
# Go to: Repo → Settings → Actions → Secrets → Add secret: EXPO_TOKEN
|
||||
# Get your token at: https://expo.dev/accounts/[username]/settings/access-tokens
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
eas-build:
|
||||
name: EAS Build (Android Preview APK)
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js 20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install EAS CLI
|
||||
run: npm install -g eas-cli
|
||||
|
||||
- name: Build Android APK (preview)
|
||||
run: eas build --platform android --profile preview --non-interactive
|
||||
env:
|
||||
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
|
||||
31
.gitea/workflows/ci.yml
Normal file
31
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- 'sprint/**'
|
||||
|
||||
jobs:
|
||||
lint-and-typecheck:
|
||||
name: Lint & TypeScript Check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js 20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run ESLint
|
||||
run: npx eslint . --ext .ts,.tsx --max-warnings 0
|
||||
|
||||
- name: Run TypeScript check
|
||||
run: npx tsc --noEmit
|
||||
103
BUILDING.md
Normal file
103
BUILDING.md
Normal 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/)
|
||||
5
app.json
5
app.json
@@ -13,13 +13,14 @@
|
||||
},
|
||||
"ios": {
|
||||
"supportsTablet": false,
|
||||
"bundleIdentifier": "space.juankibin.territorylog"
|
||||
"bundleIdentifier": "com.juankibin.territorylog"
|
||||
},
|
||||
"android": {
|
||||
"adaptiveIcon": {
|
||||
"backgroundColor": "#1A6B72"
|
||||
},
|
||||
"package": "space.juankibin.territorylog"
|
||||
"package": "com.juankibin.territorylog",
|
||||
"versionCode": 1
|
||||
},
|
||||
"web": {
|
||||
"bundler": "metro"
|
||||
|
||||
25
eas.json
Normal file
25
eas.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"cli": {
|
||||
"version": ">= 12.0.0"
|
||||
},
|
||||
"build": {
|
||||
"development": {
|
||||
"developmentClient": true,
|
||||
"distribution": "internal"
|
||||
},
|
||||
"preview": {
|
||||
"distribution": "internal",
|
||||
"android": {
|
||||
"buildType": "apk"
|
||||
}
|
||||
},
|
||||
"production": {
|
||||
"android": {
|
||||
"buildType": "app-bundle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"submit": {
|
||||
"production": {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user