10649691de
- Add Gitea Actions workflow for automatic version bumping - Update test workflow to run linting and tests - Configure Drone to build images with version tags - Separate concerns: Gitea Actions for versioning, Drone for Docker builds - Version format: MAJOR.MINOR.PATCH (auto-increment patch) - Add comprehensive CI/CD strategy documentation This prevents race conditions between Gitea Actions and Drone CI by: 1. Gitea Actions handles version bump and creates git tag 2. Tag creation triggers Drone to build Docker images 3. Both systems work sequentially, not in parallel 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
3.4 KiB
3.4 KiB
CI/CD Strategy for PicPeak
Overview
This document outlines the CI/CD strategy using both Gitea Actions and Drone CI to avoid conflicts and ensure proper versioning.
Pipeline Flow
1. Development & Testing (Gitea Actions)
- Trigger: Every push to
mainordevelopbranches - File:
.gitea/workflows/test.yml - Purpose: Run tests, linting, and basic validation
- Actions:
- Backend linting and tests
- Frontend linting and build
- Does NOT build Docker images
2. Version Management (Gitea Actions)
- Trigger: Push to
mainbranch (excluding markdown files) - File:
.gitea/workflows/version-and-release.yml - Purpose: Automatic version incrementing
- Actions:
- Reads current version from
package.json - Increments patch version (e.g., 1.0.0 → 1.0.1)
- Updates both backend and frontend
package.json - Commits the version change
- Creates a git tag (e.g.,
v1.0.1) - Pushes changes and tag
- Reads current version from
3. Docker Image Building (Drone CI)
- Trigger:
- Push to
mainordevelop(builds with commit SHA) - New git tags (builds release versions)
- Push to
- File:
.drone.yml - Purpose: Build and push Docker images
- Tags Created:
latest- Always points to newest build{commit-sha}- Specific commit version{branch}-latest- Latest for specific branchv1.0.1- Specific version (on tag trigger)
Why This Strategy?
-
Separation of Concerns:
- Gitea Actions handles code quality and versioning
- Drone CI handles Docker image building
- No overlap or race conditions
-
Sequential Execution:
- Version bump happens first
- Tag creation triggers Drone
- Docker images are built with correct version
-
Version Consistency:
- Version in
package.jsonmatches git tag - Docker images are tagged with same version
- No manual version management needed
- Version in
Setup Requirements
- Gitea Actions Runner: Must be configured and running
- Drone CI: Must be connected to your Gitea instance
- Secrets:
GITEA_TOKEN(optional, for pushing version commits)- Docker registry credentials in Drone
Version Numbering
- Format:
MAJOR.MINOR.PATCH(e.g., 1.0.0) - Automatic increments: PATCH version only
- Manual increments: Edit
package.jsonfor MAJOR/MINOR changes
Usage
-
Regular Development:
git add . git commit -m "feat: add new feature" git push origin main- Tests run automatically
- Version bumps to 1.0.1
- Docker images built with v1.0.1 tag
-
Major/Minor Version Change:
# Manually edit package.json files to 2.0.0 git add . git commit -m "feat!: major release" git push origin main -
Skip Version Bump:
- Add
[skip ci]to commit message - Or only change markdown files
- Add
Monitoring
- Gitea Actions: Check Actions tab in Gitea
- Drone CI: Check Drone dashboard
- Docker Registry: Verify images are pushed with correct tags
Troubleshooting
-
Version not incrementing:
- Check Gitea Actions logs
- Ensure runner has push permissions
- Verify no
[skip ci]in commit message
-
Docker images not building:
- Check Drone CI webhook configuration
- Verify Drone can see the repository
- Check Docker registry credentials
-
Conflicts:
- Never run both pipelines for same task
- Use branch protection to prevent direct pushes
- Always let automation handle versioning