- Gitea Actions workflow: build sor-host + sor-admin, push to Harbor, auto-update image tags in k8s manifests (GitOps — ArgoCD watches deploy/k8s/) - Dockerfile.host / Dockerfile.admin: multi-stage .NET 8 builds, non-root runtime - deploy/k8s/: configmap, deployments, services, nginx ingress - hub.aeternalisgames.com → sor-host (WebSocket gateway) - admin.aeternalisgames.com → sor-admin (Blazor admin portal) - hub-tls for hub, cert-manager auto-provisions admin-tls - deploy/secrets/: README + *.yaml.template files to populate (gitignored) - deploy/argo/application.yaml: ArgoCD Application (namespace stone-server) - Root .gitignore: excludes deploy/secrets/*.yaml (never commit populated secrets) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
86 lines
3.7 KiB
YAML
86 lines
3.7 KiB
YAML
name: Build & Push to Harbor
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
paths:
|
|
- "Server/**"
|
|
- ".gitea/workflows/**"
|
|
|
|
env:
|
|
# TODO: replace with your actual Harbor hostname
|
|
REGISTRY: harbor.aeternalisgames.com
|
|
# Harbor project name (create this in Harbor UI first)
|
|
PROJECT: sor
|
|
|
|
jobs:
|
|
build-and-push:
|
|
# TODO: update this label to match your Gitea runner's label
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
# Short SHA used as the immutable image tag.
|
|
- name: Compute image tag
|
|
id: tag
|
|
run: echo "SHA=$(echo '${{ github.sha }}' | cut -c1-8)" >> $GITHUB_OUTPUT
|
|
|
|
# Log in to Harbor using repository secrets HARBOR_USERNAME / HARBOR_PASSWORD.
|
|
- name: Log in to Harbor
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ secrets.HARBOR_USERNAME }}
|
|
password: ${{ secrets.HARBOR_PASSWORD }}
|
|
|
|
# Enable BuildKit for faster, more efficient multi-stage builds.
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
# ── SOR.Host ────────────────────────────────────────────────────────────
|
|
- name: Build and push sor-host
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: Server
|
|
file: Server/Dockerfile.host
|
|
push: true
|
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-host:buildcache
|
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-host:buildcache,mode=max
|
|
tags: |
|
|
${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-host:${{ steps.tag.outputs.SHA }}
|
|
${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-host:latest
|
|
|
|
# ── SOR.Admin ───────────────────────────────────────────────────────────
|
|
- name: Build and push sor-admin
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: Server
|
|
file: Server/Dockerfile.admin
|
|
push: true
|
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-admin:buildcache
|
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-admin:buildcache,mode=max
|
|
tags: |
|
|
${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-admin:${{ steps.tag.outputs.SHA }}
|
|
${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-admin:latest
|
|
|
|
# ── Update k8s manifests with new image tags ─────────────────────────────
|
|
# ArgoCD watches deploy/k8s/ in git; updating these tags triggers a sync.
|
|
- name: Update deployment image tags
|
|
run: |
|
|
SHA=${{ steps.tag.outputs.SHA }}
|
|
sed -i "s|image: ${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-host:.*|image: ${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-host:${SHA}|" deploy/k8s/deployment-host.yaml
|
|
sed -i "s|image: ${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-admin:.*|image: ${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-admin:${SHA}|" deploy/k8s/deployment-admin.yaml
|
|
|
|
- name: Commit updated manifests
|
|
run: |
|
|
SHA=${{ steps.tag.outputs.SHA }}
|
|
git config user.email "ci@aeternalisgames.com"
|
|
git config user.name "Gitea CI"
|
|
git add deploy/k8s/deployment-host.yaml deploy/k8s/deployment-admin.yaml
|
|
# Only commit if there are staged changes; [skip ci] prevents a re-trigger.
|
|
git diff --cached --quiet || \
|
|
git commit -m "ci: deploy image tags ${SHA} [skip ci]"
|
|
git push
|