added APK build and Gitea release to CI pipelines

This commit is contained in:
2026-02-26 13:59:22 +01:00
parent d29b8df9e3
commit f155ff88c8
3 changed files with 64 additions and 6 deletions

View File

@@ -84,6 +84,25 @@ steps:
- docker pull gitea.gilmour109.de/gilmour109/calchat-server:latest - docker pull gitea.gilmour109.de/gilmour109/calchat-server:latest
- docker compose -f /root/calchat-mongo/docker-compose.yml up -d - docker compose -f /root/calchat-mongo/docker-compose.yml up -d
- name: build_apk
image: gitea.gilmour109.de/gilmour109/eas-build:latest
environment:
EXPO_TOKEN:
from_secret: expo_token
commands:
- npm ci
- npm run build:apk
- name: release_apk
image: plugins/gitea-release
settings:
api_key:
from_secret: gitea_token
base_url: https://gitea.gilmour109.de
files:
- calchat.apk
title: latest
depends_on: depends_on:
- server_build_and_test - server_build_and_test
- check_for_formatting - check_for_formatting
@@ -131,6 +150,25 @@ steps:
- export COMMIT=$DRONE_COMMIT_SHA - export COMMIT=$DRONE_COMMIT_SHA
- envsubst < /home/debian/manifest.yml | sudo kubectl apply -f - - envsubst < /home/debian/manifest.yml | sudo kubectl apply -f -
- name: build_apk
image: gitea.gilmour109.de/gilmour109/eas-build:latest
environment:
EXPO_TOKEN:
from_secret: expo_token
commands:
- npm ci
- npm run build:apk
- name: release_apk
image: plugins/gitea-release
settings:
api_key:
from_secret: gitea_token
base_url: https://gitea.gilmour109.de
files:
- calchat.apk
title: ${DRONE_TAG}
--- ---
kind: pipeline kind: pipeline
@@ -172,3 +210,22 @@ steps:
- export NAME=$TAG - export NAME=$TAG
- export COMMIT=$DRONE_COMMIT_SHA - export COMMIT=$DRONE_COMMIT_SHA
- envsubst < /home/debian/manifest.yml | sudo kubectl apply -f - - envsubst < /home/debian/manifest.yml | sudo kubectl apply -f -
- name: build_apk
image: gitea.gilmour109.de/gilmour109/eas-build:latest
environment:
EXPO_TOKEN:
from_secret: expo_token
commands:
- npm ci
- npm run build:apk
- name: release_apk
image: plugins/gitea-release
settings:
api_key:
from_secret: gitea_token
base_url: https://gitea.gilmour109.de
files:
- calchat.apk
title: ${DRONE_COMMIT_SHA:0:8}

View File

@@ -62,7 +62,7 @@ npm run test -w @calchat/server # Run Jest unit tests
| | ical.js | iCalendar parsing/generation | | | ical.js | iCalendar parsing/generation |
| Testing | Jest / ts-jest | Server unit tests | | Testing | Jest / ts-jest | Server unit tests |
| Deployment | Docker | Server containerization (multi-stage build) | | Deployment | Docker | Server containerization (multi-stage build) |
| | Drone CI | CI/CD pipelines (build, test, format check, deploy) | | | Drone CI | CI/CD pipelines (build, test, format check, deploy, APK build + Gitea release) |
| Planned | iCalendar | Event export/import | | Planned | iCalendar | Event export/import |
## Architecture ## Architecture
@@ -684,8 +684,9 @@ This uses the `preview` profile from `eas.json` which builds an APK with:
- `arm64-v8a` architecture only (smaller APK size) - `arm64-v8a` architecture only (smaller APK size)
- No credentials required (`withoutCredentials: true`) - No credentials required (`withoutCredentials: true`)
- Internal distribution - Internal distribution
- Non-interactive mode with fixed output path (`calchat.apk`) for CI compatibility
**Requirements:** Android SDK and Java must be installed locally. **Requirements:** Android SDK and Java must be installed locally. In CI, the `eas-build` Docker image (`gitea.gilmour109.de/gilmour109/eas-build:latest`) provides the build environment with `EXPO_TOKEN` for authentication.
**EAS Configuration:** `apps/client/eas.json` contains build profiles: **EAS Configuration:** `apps/client/eas.json` contains build profiles:
- `development`: Development client with internal distribution - `development`: Development client with internal distribution
@@ -703,13 +704,13 @@ The project uses Drone CI (`.drone.yml`) with five pipelines:
**On push to main:** **On push to main:**
1. **`server_build_and_test`**: Builds the server (`npm ci` + `npm run build`) and runs Jest tests (`npm run test`) 1. **`server_build_and_test`**: Builds the server (`npm ci` + `npm run build`) and runs Jest tests (`npm run test`)
2. **`check_for_formatting`**: Checks Prettier formatting across all workspaces (`npm run check_format`) 2. **`check_for_formatting`**: Checks Prettier formatting across all workspaces (`npm run check_format`)
3. **`deploy_latest`**: Builds Docker image, pushes to Gitea Container Registry (`gitea.gilmour109.de/gilmour109/calchat-server:latest`), then SSHs into VPS (`10.0.0.1`) to pull and restart via `docker compose`. Depends on both pipelines above passing first. 3. **`deploy_latest`**: Builds Docker image, pushes to Gitea Container Registry (`gitea.gilmour109.de/gilmour109/calchat-server:latest`), then SSHs into VPS (`10.0.0.1`) to pull and restart via `docker compose`. Builds APK via `eas-build` Docker image and creates a Gitea release (title "latest") with the APK. Depends on both pipelines above passing first.
**On tag:** **On tag:**
4. **`upload_tag`**: Builds Docker image tagged with the git tag (`${DRONE_TAG}`), pushes to registry, then deploys to k3s cluster (`192.168.178.201`) via SSH using `envsubst` with a Kubernetes manifest template. 4. **`upload_tag`**: Builds Docker image tagged with the git tag (`${DRONE_TAG}`), pushes to registry, then deploys to k3s cluster (`192.168.178.201`) via SSH using `envsubst` with a Kubernetes manifest template. Builds APK and creates a Gitea release tagged with `${DRONE_TAG}`.
**On promote:** **On promote:**
5. **`upload_commit`**: Builds Docker image tagged with short commit SHA (first 8 chars), pushes to registry, then deploys to k3s cluster (`192.168.178.201`) via SSH using `envsubst` with a Kubernetes manifest template. 5. **`upload_commit`**: Builds Docker image tagged with short commit SHA (first 8 chars), pushes to registry, then deploys to k3s cluster (`192.168.178.201`) via SSH using `envsubst` with a Kubernetes manifest template. Builds APK and creates a Gitea release tagged with the short commit SHA.
## Testing ## Testing

View File

@@ -9,7 +9,7 @@
"ios": "expo start --ios", "ios": "expo start --ios",
"web": "expo start --web", "web": "expo start --web",
"lint": "expo lint", "lint": "expo lint",
"build:apk": "eas build --platform android --profile preview --local" "build:apk": "eas build --platform android --profile preview --local --non-interactive --output ./calchat.apk"
}, },
"dependencies": { "dependencies": {
"@calchat/shared": "*", "@calchat/shared": "*",