From d094809838e7c1065e83a98cba82a8516af3650c Mon Sep 17 00:00:00 2001 From: cal Date: Wed, 4 Feb 2026 05:41:18 +0000 Subject: [PATCH 1/4] Add automated docker build --- .gitea/workflows/docker-build.yml | 75 +++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .gitea/workflows/docker-build.yml diff --git a/.gitea/workflows/docker-build.yml b/.gitea/workflows/docker-build.yml new file mode 100644 index 0000000..dc82e4b --- /dev/null +++ b/.gitea/workflows/docker-build.yml @@ -0,0 +1,75 @@ +name: Build Docker Image + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Extract metadata + id: meta + run: | + echo "sha_short=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT + echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT + echo "timestamp=$(date -u +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT + + - name: Build Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: false + tags: | + paper-dynasty:latest + paper-dynasty:${{ steps.meta.outputs.sha_short }} + cache-from: type=gha + cache-to: type=gha,mode=max + outputs: type=docker,dest=/tmp/paper-dynasty-image.tar + + - name: Build Summary + run: | + echo "## 🐳 Docker Build Successful! ✅" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "**Image Tags:**" >> $GITHUB_STEP_SUMMARY + echo "- \`paper-dynasty:latest\`" >> $GITHUB_STEP_SUMMARY + echo "- \`paper-dynasty:${{ steps.meta.outputs.sha_short }}\`" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "**Build Details:**" >> $GITHUB_STEP_SUMMARY + echo "- Branch: \`${{ steps.meta.outputs.branch }}\`" >> $GITHUB_STEP_SUMMARY + echo "- Commit: \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY + echo "- Timestamp: \`${{ steps.meta.outputs.timestamp }}\`" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "_Ready to deploy to production!_" >> $GITHUB_STEP_SUMMARY + + - name: Save build info + run: | + mkdir -p artifacts + cat > artifacts/build-info.txt < Date: Wed, 4 Feb 2026 05:48:40 +0000 Subject: [PATCH 2/4] Update .gitea/workflows/docker-build.yml --- .gitea/workflows/docker-build.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/docker-build.yml b/.gitea/workflows/docker-build.yml index dc82e4b..c085952 100644 --- a/.gitea/workflows/docker-build.yml +++ b/.gitea/workflows/docker-build.yml @@ -1,4 +1,4 @@ -name: Build Docker Image +ame: Build Docker Image on: push: @@ -22,7 +22,11 @@ jobs: - name: Extract metadata id: meta run: | - echo "sha_short=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT + VERSION=$(cat VERSION 2>/dev/null || echo "0.0.0") + SHA_SHORT=$(echo ${{ github.sha }} | cut -c1-7) + echo "version=${VERSION}" >> $GITHUB_OUTPUT + echo "sha_short=${SHA_SHORT}" >> $GITHUB_OUTPUT + echo "version_sha=v${VERSION}-${SHA_SHORT}" >> $GITHUB_OUTPUT echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT echo "timestamp=$(date -u +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT @@ -33,7 +37,8 @@ jobs: push: false tags: | paper-dynasty:latest - paper-dynasty:${{ steps.meta.outputs.sha_short }} + paper-dynasty:v${{ steps.meta.outputs.version }} + paper-dynasty:${{ steps.meta.outputs.version_sha }} cache-from: type=gha cache-to: type=gha,mode=max outputs: type=docker,dest=/tmp/paper-dynasty-image.tar @@ -44,7 +49,8 @@ jobs: echo "" >> $GITHUB_STEP_SUMMARY echo "**Image Tags:**" >> $GITHUB_STEP_SUMMARY echo "- \`paper-dynasty:latest\`" >> $GITHUB_STEP_SUMMARY - echo "- \`paper-dynasty:${{ steps.meta.outputs.sha_short }}\`" >> $GITHUB_STEP_SUMMARY + echo "- \`paper-dynasty:v${{ steps.meta.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY + echo "- \`paper-dynasty:${{ steps.meta.outputs.version_sha }}\`" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "**Build Details:**" >> $GITHUB_STEP_SUMMARY echo "- Branch: \`${{ steps.meta.outputs.branch }}\`" >> $GITHUB_STEP_SUMMARY @@ -59,7 +65,8 @@ jobs: cat > artifacts/build-info.txt < Date: Wed, 4 Feb 2026 05:52:17 +0000 Subject: [PATCH 3/4] Update .gitea/workflows/docker-build.yml --- .gitea/workflows/docker-build.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.gitea/workflows/docker-build.yml b/.gitea/workflows/docker-build.yml index c085952..afa21f6 100644 --- a/.gitea/workflows/docker-build.yml +++ b/.gitea/workflows/docker-build.yml @@ -72,11 +72,3 @@ jobs: Author: ${{ github.actor }} Timestamp: ${{ steps.meta.outputs.timestamp }} EOF - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: build-info - path: artifacts/build-info.txt - retention-days: 30 - From 175a19b372d33e03f7ca3a45d3a66149eecb25c5 Mon Sep 17 00:00:00 2001 From: cal Date: Wed, 4 Feb 2026 06:01:01 +0000 Subject: [PATCH 4/4] Update .gitea/workflows/docker-build.yml --- .gitea/workflows/docker-build.yml | 83 +++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/.gitea/workflows/docker-build.yml b/.gitea/workflows/docker-build.yml index afa21f6..aab13d9 100644 --- a/.gitea/workflows/docker-build.yml +++ b/.gitea/workflows/docker-build.yml @@ -72,3 +72,86 @@ jobs: Author: ${{ github.actor }} Timestamp: ${{ steps.meta.outputs.timestamp }} EOF + + - name: Discord Notification - Success + if: success() && github.ref == 'refs/heads/main' + run: | + curl -H "Content-Type: application/json" \ + -d '{ + "embeds": [{ + "title": "✅ Paper Dynasty Build Successful", + "description": "Docker image built and ready to deploy!", + "color": 3066993, + "fields": [ + { + "name": "Version", + "value": "`v${{ steps.meta.outputs.version }}`", + "inline": true + }, + { + "name": "Image Tag", + "value": "`${{ steps.meta.outputs.version_sha }}`", + "inline": true + }, + { + "name": "Branch", + "value": "`${{ steps.meta.outputs.branch }}`", + "inline": true + }, + { + "name": "Commit", + "value": "`${{ steps.meta.outputs.sha_short }}`", + "inline": true + }, + { + "name": "Author", + "value": "${{ github.actor }}", + "inline": true + }, + { + "name": "View Run", + "value": "[Click here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})", + "inline": false + } + ], + "timestamp": "${{ steps.meta.outputs.timestamp }}" + }] + }' \ + https://discord.com/api/webhooks/1468485116631453840/JALtLV8dO2IWso3tNcntHW8wDgQeMZuLgFKVUeoEY9ig_OPjjm4PmjvzwYebH5l7_Nxv + + - name: Discord Notification - Failure + if: failure() && github.ref == 'refs/heads/main' + run: | + curl -H "Content-Type: application/json" \ + -d '{ + "embeds": [{ + "title": "❌ Paper Dynasty Build Failed", + "description": "Docker build encountered an error.", + "color": 15158332, + "fields": [ + { + "name": "Branch", + "value": "`${{ github.ref_name }}`", + "inline": true + }, + { + "name": "Commit", + "value": "`${{ github.sha }}`", + "inline": true + }, + { + "name": "Author", + "value": "${{ github.actor }}", + "inline": true + }, + { + "name": "View Logs", + "value": "[Click here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})", + "inline": false + } + ], + "timestamp": "'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'" + }] + }' \ + https://discord.com/api/webhooks/1468485116631453840/JALtLV8dO2IWso3tNcntHW8wDgQeMZuLgFKVUeoEY9ig_OPjjm4PmjvzwYebH5l7_Nxv +