Files
MileVault/.gitea/workflows/build.yml
T
owain 24f8417982
Build and push images / validate (push) Successful in 2s
Build and push images / build-backend (push) Successful in 5s
Build and push images / build-worker (push) Successful in 5s
Build and push images / build-frontend (push) Successful in 21s
Fix package.json, Dockerfile, add CI validation to prevent recurrence
2026-06-06 18:27:29 +01:00

96 lines
3.0 KiB
YAML

name: Build and push images
on:
push:
branches: [main]
workflow_dispatch:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate package.json
run: |
# Fail if package.json is invalid JSON
python3 -c "import json, sys; json.load(open('frontend/package.json'))" || \
{ echo "ERROR: frontend/package.json is invalid JSON"; exit 1; }
# Fail if non-existent packages are present
if grep -q "@polyline-codec" frontend/package.json; then
echo "ERROR: @polyline-codec/core does not exist on npm - remove it"
exit 1
fi
# Fail if npm ci is still in Dockerfile (requires lockfile we don't have)
if grep -q "npm ci" frontend/Dockerfile; then
echo "ERROR: frontend/Dockerfile uses 'npm ci' but no package-lock.json exists - change to 'npm install'"
exit 1
fi
echo "Validation passed"
build-backend:
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to registry
run: echo "${{ secrets.PACKAGE_TOKEN }}" | docker login gitea.jarrett.eu -u ${{ gitea.actor }} --password-stdin
- name: Build and push backend
uses: docker/build-push-action@v5
with:
context: ./backend
file: ./backend/Dockerfile
push: true
tags: |
gitea.jarrett.eu/${{ gitea.repository_owner }}/milevault-backend:latest
gitea.jarrett.eu/${{ gitea.repository_owner }}/milevault-backend:${{ gitea.sha }}
build-worker:
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to registry
run: echo "${{ secrets.PACKAGE_TOKEN }}" | docker login gitea.jarrett.eu -u ${{ gitea.actor }} --password-stdin
- name: Build and push worker
uses: docker/build-push-action@v5
with:
context: ./backend
file: ./backend/Dockerfile.worker
push: true
tags: |
gitea.jarrett.eu/${{ gitea.repository_owner }}/milevault-worker:latest
gitea.jarrett.eu/${{ gitea.repository_owner }}/milevault-worker:${{ gitea.sha }}
build-frontend:
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to registry
run: echo "${{ secrets.PACKAGE_TOKEN }}" | docker login gitea.jarrett.eu -u ${{ gitea.actor }} --password-stdin
- name: Build and push frontend
uses: docker/build-push-action@v5
with:
context: ./frontend
file: ./frontend/Dockerfile
push: true
tags: |
gitea.jarrett.eu/${{ gitea.repository_owner }}/milevault-frontend:latest
gitea.jarrett.eu/${{ gitea.repository_owner }}/milevault-frontend:${{ gitea.sha }}
build-args: |
VITE_API_URL=/api
VITE_MAPBOX_TOKEN=