word-waltz / files / .fw-ci.yml
.fw-ci.yml
| 1 | stages: |
| 2 | - build |
| 3 | - deploy |
| 4 | - cleanup |
| 5 | |
| 6 | variables: |
| 7 | NODE_VERSION: "20" |
| 8 | |
| 9 | build: |
| 10 | stage: build |
| 11 | image: node:${NODE_VERSION}-alpine |
| 12 | script: |
| 13 | - npm ci |
| 14 | - npm run build |
| 15 | artifacts: |
| 16 | paths: |
| 17 | - dist/ |
| 18 | expire_in: 1 hour |
| 19 | rules: |
| 20 | - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH |
| 21 | |
| 22 | pages: |
| 23 | stage: deploy |
| 24 | image: alpine:latest |
| 25 | # GitLab Pages expects the artifact to be in a folder named "public" |
| 26 | script: |
| 27 | - mv dist public |
| 28 | artifacts: |
| 29 | paths: |
| 30 | - public |
| 31 | rules: |
| 32 | - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH |
| 33 | needs: |
| 34 | - build |
| 35 | |
| 36 | # Firebase config is committed directly in src/firebase/config.ts. |
| 37 | # No CI/CD variables are needed for the build job. |
| 38 | |
| 39 | # --------------------------------------------------------------------------- |
| 40 | # Scheduled cleanup — deletes Firestore games inactive for > 30 days. |
| 41 | # Trigger: create a Pipeline Schedule in GitLab (e.g. "0 3 * * *" = 03:00 UTC). |
| 42 | # Required masked CI/CD variable for the cleanup job: |
| 43 | # FIREBASE_SERVICE_ACCOUNT_JSON — service-account JSON with Firestore write access |
| 44 | # The Firebase project ID is read from src/firebase/config.ts in the repo. |
| 45 | # --------------------------------------------------------------------------- |
| 46 | cleanup-old-games: |
| 47 | stage: cleanup |
| 48 | image: node:${NODE_VERSION}-alpine |
| 49 | script: |
| 50 | - npm ci |
| 51 | - node scripts/cleanup-old-games.js |
| 52 | rules: |
| 53 | - if: $CI_PIPELINE_SOURCE == "schedule" |