major-domo-v2/.gitea/workflows/docker-build.yml
Cal Corum 3c24e03a0c ci: switch to tag-triggered releases with production Docker tag
Replace branch-push trigger with tag-push trigger (20* pattern).
Version is extracted from the git tag itself instead of auto-generated.
Docker images are tagged with the CalVer version + floating "production" tag.

To release: git tag YYYY.M.BUILD && git push --tags

Also updates CLAUDE.md to document the new workflow and removes all
next-release branch references (branch retired).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 13:18:49 -05:00

91 lines
3.5 KiB
YAML

# Gitea Actions: Docker Build, Push, and Notify
#
# CI/CD pipeline for Major Domo Discord Bot:
# - Triggered by pushing a CalVer tag (e.g., 2026.3.11)
# - Builds Docker image and pushes to Docker Hub with version + production tags
# - Sends Discord notifications on success/failure
#
# To release: git tag 2026.3.11 && git push --tags
name: Build Docker Image
on:
push:
tags:
- '20*' # matches CalVer tags like 2026.3.11
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: https://github.com/actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/}
SHA_SHORT=$(git rev-parse --short HEAD)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "sha_short=$SHA_SHORT" >> $GITHUB_OUTPUT
echo "timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT
- 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: Build and push Docker image
uses: https://github.com/docker/build-push-action@v5
with:
context: .
push: true
tags: |
manticorum67/major-domo-discordapp:${{ steps.version.outputs.version }}
manticorum67/major-domo-discordapp:production
cache-from: type=registry,ref=manticorum67/major-domo-discordapp:buildcache
cache-to: type=registry,ref=manticorum67/major-domo-discordapp:buildcache,mode=max
- name: Build Summary
run: |
echo "## Docker Build Successful" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** \`${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Image Tags:**" >> $GITHUB_STEP_SUMMARY
echo "- \`manticorum67/major-domo-discordapp:${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`manticorum67/major-domo-discordapp:production\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Build Details:**" >> $GITHUB_STEP_SUMMARY
echo "- Commit: \`${{ steps.version.outputs.sha_short }}\`" >> $GITHUB_STEP_SUMMARY
echo "- Timestamp: \`${{ steps.version.outputs.timestamp }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Pull with: \`docker pull manticorum67/major-domo-discordapp:${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
- name: Discord Notification - Success
if: success()
uses: cal/gitea-actions/discord-notify@main
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
title: "Major Domo Bot"
status: success
version: ${{ steps.version.outputs.version }}
image_tag: ${{ steps.version.outputs.version }}
commit_sha: ${{ steps.version.outputs.sha_short }}
timestamp: ${{ steps.version.outputs.timestamp }}
- name: Discord Notification - Failure
if: failure()
uses: cal/gitea-actions/discord-notify@main
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
title: "Major Domo Bot"
status: failure