From c185d72f1bb7f1e75d8ead6c4f63b94926a7623a Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Mon, 23 Mar 2026 16:05:17 -0500 Subject: [PATCH 1/2] ci: add dev tag trigger to Docker build workflow Allows deploying to dev environment by pushing a "dev" tag. Dev tags build with :dev Docker tag instead of :production. Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitea/workflows/build.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 4245558..e242b50 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -1,11 +1,13 @@ # Gitea Actions: Docker Build, Push, and Notify # # CI/CD pipeline for Paper Dynasty Database API: -# - Triggered by pushing a CalVer tag (e.g., 2026.3.11) -# - Builds Docker image and pushes to Docker Hub with version + production tags +# - Triggered by pushing a CalVer tag (e.g., 2026.3.11) or "dev" tag +# - CalVer tags push with version + "production" Docker tags +# - "dev" tag pushes with "dev" Docker tag for the dev environment # - Sends Discord notifications on success/failure # # To release: git tag 2026.3.11 && git push origin 2026.3.11 +# To deploy dev: git tag -f dev && git push origin dev --force name: Build Docker Image @@ -13,6 +15,7 @@ on: push: tags: - '20*' # matches CalVer tags like 2026.3.11 + - 'dev' # dev environment builds jobs: build: @@ -32,6 +35,11 @@ jobs: echo "version=$VERSION" >> $GITHUB_OUTPUT echo "sha_short=$SHA_SHORT" >> $GITHUB_OUTPUT echo "timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT + if [ "$VERSION" = "dev" ]; then + echo "environment=dev" >> $GITHUB_OUTPUT + else + echo "environment=production" >> $GITHUB_OUTPUT + fi - name: Set up Docker Buildx uses: https://github.com/docker/setup-buildx-action@v3 @@ -49,7 +57,7 @@ jobs: push: true tags: | manticorum67/paper-dynasty-database:${{ steps.version.outputs.version }} - manticorum67/paper-dynasty-database:production + manticorum67/paper-dynasty-database:${{ steps.version.outputs.environment }} cache-from: type=registry,ref=manticorum67/paper-dynasty-database:buildcache cache-to: type=registry,ref=manticorum67/paper-dynasty-database:buildcache,mode=max @@ -61,7 +69,7 @@ jobs: echo "" >> $GITHUB_STEP_SUMMARY echo "**Image Tags:**" >> $GITHUB_STEP_SUMMARY echo "- \`manticorum67/paper-dynasty-database:${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY - echo "- \`manticorum67/paper-dynasty-database:production\`" >> $GITHUB_STEP_SUMMARY + echo "- \`manticorum67/paper-dynasty-database:${{ steps.version.outputs.environment }}\`" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "**Build Details:**" >> $GITHUB_STEP_SUMMARY echo "- Commit: \`${{ steps.version.outputs.sha_short }}\`" >> $GITHUB_STEP_SUMMARY From d0f45d5d38e091585a9167a48a8a9f23a65804df Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Mon, 23 Mar 2026 21:16:00 -0500 Subject: [PATCH 2/2] ci: switch buildx cache from registry to local volume Replaces type=registry cache (which causes 400 errors from Docker Hub due to stale buildx builders) with type=local backed by a named Docker volume on the runner. Adds cache rotation step to prevent unbounded growth. Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitea/workflows/build.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index e242b50..367692f 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -20,6 +20,9 @@ on: jobs: build: runs-on: ubuntu-latest + container: + volumes: + - pd-buildx-cache:/opt/buildx-cache steps: - name: Checkout code @@ -58,8 +61,13 @@ jobs: tags: | manticorum67/paper-dynasty-database:${{ steps.version.outputs.version }} manticorum67/paper-dynasty-database:${{ steps.version.outputs.environment }} - cache-from: type=registry,ref=manticorum67/paper-dynasty-database:buildcache - cache-to: type=registry,ref=manticorum67/paper-dynasty-database:buildcache,mode=max + cache-from: type=local,src=/opt/buildx-cache/pd-database + cache-to: type=local,dest=/opt/buildx-cache/pd-database-new,mode=max + + - name: Rotate cache + run: | + rm -rf /opt/buildx-cache/pd-database + mv /opt/buildx-cache/pd-database-new /opt/buildx-cache/pd-database - name: Build Summary run: |