7.4 KiB
Gitea Actions Setup for Major Domo Database
Complete CI/CD pipeline for automated Docker builds, semantic versioning, and Discord notifications.
Overview
The Gitea Actions workflow in .gitea/workflows/docker-build.yml provides:
- ✅ Semantic version validation on pull requests
- ✅ Automated Docker image builds
- ✅ Push to Docker Hub on main branch merges
- ✅ Discord notifications for build success/failure
- ✅ Multi-tag strategy (latest, version, version+commit)
- ✅ Build caching for faster builds
Initial Setup
1. Create Docker Hub Access Token
- Go to https://hub.docker.com
- Login → Account Settings → Security
- Click "New Access Token"
- Name:
gitea-major-domo-database - Permissions: Read & Write
- Copy the token (you won't see it again!)
2. Add Gitea Secrets
- Go to https://git.manticorum.com/cal/major-domo-database
- Navigate to: Settings → Secrets → Actions
- Add three secrets:
| Secret Name | Value |
|---|---|
DOCKERHUB_USERNAME |
manticorum67 |
DOCKERHUB_TOKEN |
[Docker Hub access token from step 1] |
DISCORD_WEBHOOK_URL |
[Discord webhook URL for build notifications] |
3. Create Discord Webhook (Optional)
If you want build notifications in Discord:
- Open Discord channel for CI/CD notifications
- Right-click channel → Edit Channel → Integrations
- Click "Create Webhook"
- Name:
Major Domo Database CI - Copy webhook URL
- Add as
DISCORD_WEBHOOK_URLsecret in Gitea (step 2 above)
4. Enable Actions in Repository
- Go to repository settings in Gitea
- Navigate to "Workflow" or "Actions" section
- Enable Actions for this repository
Usage
Creating a Pull Request
-
Create a feature branch:
git checkout -b feature/my-feature -
Make your changes
-
Bump the VERSION file (required for PR approval):
# Current version: 2.4.1 # For bug fix: echo "2.4.2" > VERSION # For new feature: echo "2.5.0" > VERSION # For breaking change: echo "3.0.0" > VERSION -
Commit and push:
git add . git commit -m "Add new feature" git push origin feature/my-feature -
Create PR in Gitea
The workflow will:
- ✅ Validate the VERSION bump follows semantic versioning
- ✅ Build the Docker image (but not push it)
- ❌ Block the PR if VERSION wasn't bumped or is invalid
Merging to Main
When you merge the PR to main:
The workflow will:
- Build the Docker image
- Push to Docker Hub with three tags:
manticorum67/major-domo-database:latestmanticorum67/major-domo-database:v2.4.2manticorum67/major-domo-database:v2.4.2-a1b2c3d
- Send Discord notification (if configured)
- Create build summary in Actions UI
Semantic Versioning Rules
The workflow enforces strict semantic versioning:
Valid Version Bumps
| Type | Example | When to Use |
|---|---|---|
| Patch | 2.4.1 → 2.4.2 | Bug fixes, minor tweaks |
| Minor | 2.4.1 → 2.5.0 | New features, backward compatible |
| Major | 2.4.1 → 3.0.0 | Breaking changes |
Invalid Version Bumps
❌ Skipping versions: 2.4.1 → 2.6.0 (skipped 2.5.0)
❌ Going backwards: 2.4.1 → 2.3.0
❌ Not resetting: 2.4.1 → 2.5.1 (should be 2.5.0)
❌ No change: 2.4.1 → 2.4.1
Manual Deployment
Use the included deploy.sh script for manual deployments:
# Deploy latest version
./deploy.sh
# Deploy specific version
./deploy.sh v2.4.2
The script will:
- Check SSH connection to production server
- Verify container exists
- Ask for confirmation
- Pull new image
- Restart container
- Show status and recent logs
Deployment Server Details
- Server: strat-database (10.10.0.42)
- User: cal
- Path: /home/cal/container-data/sba-database
- Container: sba_database
- Image: manticorum67/major-domo-database
Troubleshooting
PR Blocked - VERSION Not Updated
Error: "VERSION file has not been updated!"
Solution: Update the VERSION file in your branch:
echo "2.4.2" > VERSION
git add VERSION
git commit -m "Bump version to 2.4.2"
git push
PR Blocked - Invalid Semantic Version
Error: "Invalid semantic version change!"
Solution: Follow semantic versioning rules. From 2.4.1:
- Bug fix →
2.4.2(not 2.4.3, 2.5.0, etc.) - New feature →
2.5.0(not 2.6.0, 2.5.1, etc.) - Breaking change →
3.0.0(not 4.0.0, 3.1.0, etc.)
Docker Hub Push Failed
Error: "unauthorized: authentication required"
Solution:
- Verify
DOCKERHUB_USERNAMEandDOCKERHUB_TOKENsecrets are set - Check Docker Hub token hasn't expired
- Regenerate token if needed and update secret
Discord Notifications Not Appearing
Problem: Build succeeds but no Discord message
Solutions:
- Verify
DISCORD_WEBHOOK_URLsecret is set correctly - Test webhook manually:
curl -H "Content-Type: application/json" \ -d '{"content": "Test message"}' \ YOUR_WEBHOOK_URL - Check webhook still exists in Discord channel settings
Build Failing on Main but PR Passed
Possible causes:
- Merge conflict not resolved properly
- Dependencies changed between PR and merge
- Docker Hub credentials invalid
Solution:
- Check Actions logs in Gitea
- Look for specific error messages
- Test build locally:
docker build -t test-build .
Viewing Build Status
In Gitea
- Go to repository → Actions
- Click on workflow run to see details
- View step-by-step logs
- Check build summary
In Discord
If webhook is configured, you'll get:
- ✅ Green embed on successful builds
- ❌ Red embed on failed builds
- Version, commit, and Docker Hub link
On Docker Hub
- Go to https://hub.docker.com/r/manticorum67/major-domo-database
- Check "Tags" tab for new versions
- Verify timestamp matches your push
Advanced Usage
Disable Version Validation
If you need to merge without version bump (not recommended):
- Edit
.gitea/workflows/docker-build.yml - Delete or comment out the "Check VERSION was bumped" step
- Commit and push
Disable Discord Notifications
- Edit
.gitea/workflows/docker-build.yml - Delete both "Discord Notification" steps
- Commit and push
Add Additional Tags
Edit the "Build Docker image" step in the workflow:
tags: |
manticorum67/major-domo-database:latest
manticorum67/major-domo-database:v${{ steps.meta.outputs.version }}
manticorum67/major-domo-database:${{ steps.meta.outputs.version_sha }}
manticorum67/major-domo-database:stable # Add custom tag
Workflow File Location
The workflow is located at:
.gitea/workflows/docker-build.yml
This file is tracked in git and will be used automatically by Gitea Actions when:
- You push to main branch
- You create a pull request to main branch
Related Documentation
Questions or Issues?
If you encounter problems:
- Check Actions logs in Gitea
- Review this troubleshooting section
- Test components manually (Docker build, webhook, etc.)
- Check Gitea Actions runner status
Last Updated: 2026-02-04 Current Version: 2.4.1 Template Version: 1.0.0 (based on paper-dynasty-database)