From f155ff88c8e8bc5e9a32566cd4be937bb9dfd25a Mon Sep 17 00:00:00 2001 From: Linus Waldowsky Date: Thu, 26 Feb 2026 13:59:22 +0100 Subject: [PATCH] added APK build and Gitea release to CI pipelines --- .drone.yml | 57 ++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 11 ++++---- apps/client/package.json | 2 +- 3 files changed, 64 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index ccb3446..4b88f9b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -84,6 +84,25 @@ steps: - docker pull gitea.gilmour109.de/gilmour109/calchat-server:latest - 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: - server_build_and_test - check_for_formatting @@ -131,6 +150,25 @@ steps: - export COMMIT=$DRONE_COMMIT_SHA - 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 @@ -172,3 +210,22 @@ steps: - export NAME=$TAG - export COMMIT=$DRONE_COMMIT_SHA - 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} diff --git a/CLAUDE.md b/CLAUDE.md index 7479a50..23aad68 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -62,7 +62,7 @@ npm run test -w @calchat/server # Run Jest unit tests | | ical.js | iCalendar parsing/generation | | Testing | Jest / ts-jest | Server unit tests | | 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 | ## 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) - No credentials required (`withoutCredentials: true`) - 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: - `development`: Development client with internal distribution @@ -703,13 +704,13 @@ The project uses Drone CI (`.drone.yml`) with five pipelines: **On push to main:** 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`) -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:** -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:** -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 diff --git a/apps/client/package.json b/apps/client/package.json index 91c3aec..7bb89b6 100644 --- a/apps/client/package.json +++ b/apps/client/package.json @@ -9,7 +9,7 @@ "ios": "expo start --ios", "web": "expo start --web", "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": { "@calchat/shared": "*",