All checks were successful
Build Docker Image / build (push) Successful in 8m19s
Registry cache export consistently fails with 400 Bad Request from Docker Hub, likely due to blob size limits on the free tier after the base image change. Removing cache-from/cache-to entirely — builds are fast enough without it (~2 min), and we can re-add with a local cache backend later if needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
104 lines
3.8 KiB
YAML
104 lines
3.8 KiB
YAML
# Gitea Actions: Docker Build, Push, and Notify
|
|
#
|
|
# CI/CD pipeline for Paper Dynasty Database API:
|
|
# - Builds Docker images on every push/PR
|
|
# - Auto-generates CalVer version (YYYY.MM.BUILD) on main branch merges
|
|
# - Supports multi-channel releases: stable (main), rc (next-release), dev (PRs)
|
|
# - Pushes to Docker Hub and creates git tag on main
|
|
# - Sends Discord notifications on success/failure
|
|
|
|
name: Build Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- next-release
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://github.com/actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # Full history for tag counting
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: https://github.com/docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: https://github.com/docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Generate CalVer version
|
|
id: calver
|
|
uses: cal/gitea-actions/calver@main
|
|
|
|
- name: Resolve Docker tags
|
|
id: tags
|
|
uses: cal/gitea-actions/docker-tags@main
|
|
with:
|
|
image: manticorum67/paper-dynasty-database
|
|
version: ${{ steps.calver.outputs.version }}
|
|
sha_short: ${{ steps.calver.outputs.sha_short }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: https://github.com/docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.tags.outputs.tags }}
|
|
|
|
- name: Tag release
|
|
if: success() && github.ref == 'refs/heads/main'
|
|
uses: cal/gitea-actions/gitea-tag@main
|
|
with:
|
|
version: ${{ steps.calver.outputs.version }}
|
|
token: ${{ github.token }}
|
|
|
|
- name: Build Summary
|
|
run: |
|
|
echo "## Docker Build Successful" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "**Channel:** \`${{ steps.tags.outputs.channel }}\`" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "**Image Tags:**" >> $GITHUB_STEP_SUMMARY
|
|
IFS=',' read -ra TAG_ARRAY <<< "${{ steps.tags.outputs.tags }}"
|
|
for tag in "${TAG_ARRAY[@]}"; do
|
|
echo "- \`${tag}\`" >> $GITHUB_STEP_SUMMARY
|
|
done
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "**Build Details:**" >> $GITHUB_STEP_SUMMARY
|
|
echo "- Branch: \`${{ steps.calver.outputs.branch }}\`" >> $GITHUB_STEP_SUMMARY
|
|
echo "- Commit: \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
|
|
echo "- Timestamp: \`${{ steps.calver.outputs.timestamp }}\`" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "Pull with: \`docker pull manticorum67/paper-dynasty-database:${{ steps.tags.outputs.primary_tag }}\`" >> $GITHUB_STEP_SUMMARY
|
|
|
|
- name: Discord Notification - Success
|
|
if: success() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next-release')
|
|
uses: cal/gitea-actions/discord-notify@main
|
|
with:
|
|
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
|
|
title: "Paper Dynasty Database"
|
|
status: success
|
|
version: ${{ steps.calver.outputs.version }}
|
|
image_tag: ${{ steps.tags.outputs.primary_tag }}
|
|
commit_sha: ${{ steps.calver.outputs.sha_short }}
|
|
timestamp: ${{ steps.calver.outputs.timestamp }}
|
|
|
|
- name: Discord Notification - Failure
|
|
if: failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next-release')
|
|
uses: cal/gitea-actions/discord-notify@main
|
|
with:
|
|
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
|
|
title: "Paper Dynasty Database"
|
|
status: failure
|