beeta/.forgejo/workflows/build.yml

107 lines
4.2 KiB
YAML
Raw Normal View History

2026-01-05 22:54:27 -05:00
# =============================================================================
# Build and Push Docker Images to Forgejo Registry
# =============================================================================
# Triggers on push to main branch and pull requests
# Builds sequentially: backend, frontend, chat-service, openresty
# Single job to avoid rate limiting on git clone
2026-01-05 22:54:27 -05:00
# =============================================================================
name: Build and Push
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
2026-01-05 23:37:40 -05:00
workflow_dispatch: # Enable manual trigger
2026-01-05 22:54:27 -05:00
env:
REGISTRY: qbit.realms.pub
jobs:
build-all:
2026-01-06 00:26:54 -05:00
runs-on: ubuntu-latest
container:
image: docker:27
options: --privileged
2026-01-05 22:54:27 -05:00
steps:
- name: Install git
run: apk add --no-cache git
2026-01-05 22:54:27 -05:00
- name: Checkout code
run: |
git clone --depth 1 --branch ${GITHUB_REF_NAME:-main} https://qbit.realms.pub/${GITHUB_REPOSITORY}.git .
2026-01-05 22:54:27 -05:00
- name: Login to Forgejo Registry
if: github.event_name == 'push'
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin
# =========================================================================
# Build Backend (C++/Drogon)
# =========================================================================
2026-01-05 22:54:27 -05:00
- name: Build Backend Image
run: |
echo "=== Building Backend ==="
2026-01-05 22:54:27 -05:00
docker build \
-t ${{ env.REGISTRY }}/${{ github.repository }}/backend:${{ github.sha }} \
-t ${{ env.REGISTRY }}/${{ github.repository }}/backend:latest \
2026-01-05 22:54:27 -05:00
./backend
- name: Push Backend Image
if: github.event_name == 'push'
run: |
docker push ${{ env.REGISTRY }}/${{ github.repository }}/backend:${{ github.sha }}
docker push ${{ env.REGISTRY }}/${{ github.repository }}/backend:latest
2026-01-05 22:54:27 -05:00
# =========================================================================
# Build Frontend (SvelteKit)
# =========================================================================
2026-01-05 22:54:27 -05:00
- name: Build Frontend Image
run: |
echo "=== Building Frontend ==="
2026-01-05 22:54:27 -05:00
docker build \
-t ${{ env.REGISTRY }}/${{ github.repository }}/frontend:${{ github.sha }} \
-t ${{ env.REGISTRY }}/${{ github.repository }}/frontend:latest \
2026-01-05 22:54:27 -05:00
./frontend
- name: Push Frontend Image
if: github.event_name == 'push'
run: |
docker push ${{ env.REGISTRY }}/${{ github.repository }}/frontend:${{ github.sha }}
docker push ${{ env.REGISTRY }}/${{ github.repository }}/frontend:latest
2026-01-05 22:54:27 -05:00
# =========================================================================
# Build Chat Service
# =========================================================================
2026-01-05 22:54:27 -05:00
- name: Build Chat Service Image
run: |
echo "=== Building Chat Service ==="
2026-01-05 22:54:27 -05:00
docker build \
-t ${{ env.REGISTRY }}/${{ github.repository }}/chat-service:${{ github.sha }} \
-t ${{ env.REGISTRY }}/${{ github.repository }}/chat-service:latest \
2026-01-05 22:54:27 -05:00
./chat-service
- name: Push Chat Service Image
if: github.event_name == 'push'
run: |
docker push ${{ env.REGISTRY }}/${{ github.repository }}/chat-service:${{ github.sha }}
docker push ${{ env.REGISTRY }}/${{ github.repository }}/chat-service:latest
2026-01-05 22:54:27 -05:00
# =========================================================================
# Build OpenResty (Nginx + Lua)
# =========================================================================
2026-01-05 22:54:27 -05:00
- name: Build OpenResty Image
run: |
echo "=== Building OpenResty ==="
2026-01-05 22:54:27 -05:00
docker build \
-t ${{ env.REGISTRY }}/${{ github.repository }}/openresty:${{ github.sha }} \
-t ${{ env.REGISTRY }}/${{ github.repository }}/openresty:latest \
2026-01-05 22:54:27 -05:00
./openresty
- name: Push OpenResty Image
if: github.event_name == 'push'
run: |
docker push ${{ env.REGISTRY }}/${{ github.repository }}/openresty:${{ github.sha }}
docker push ${{ env.REGISTRY }}/${{ github.repository }}/openresty:latest