# CI/CD with Gitea Actions for NaviWatcher This repository uses Gitea Actions to automatically build and publish Docker images. ## Workflow Overview The workflow (`.gitea/workflows/docker-build.yml`) performs the following steps: 1. **Trigger Conditions**: - Pushes to `main` or `master` branches - Pull requests targeting `main` or `master` - Pushes of version tags (e.g., `v1.0.0`, `v2.1.0`) 2. **Job Steps**: - Checkout repository code - Set up Go environment (version 1.25) - Run `go mod tidy` and `go mod verify` - Execute unit tests with coverage - Set up Docker Buildx for multi-platform builds - Authenticate with container registry - Extract metadata for image tagging - Build and push Docker image to registry ## Required Secrets To use this workflow, you need to configure the following secrets in your Gitea repository: 1. **REGISTRY_USERNAME** - Username for your container registry 2. **REGISTRY_PASSWORD** - Password or access token for your container registry 3. **REGISTRY** - The registry URL (e.g., `docker.io`, `ghcr.io`, or your private registry) 4. **IMAGE_NAME** - The name for your Docker image (e.g., `naviwatcher`) ## Environment Variables The workflow uses these environment variables (can be configured in the workflow or repository settings): - `REGISTRY`: Container registry URL - `IMAGE_NAME`: Name of the Docker image ## Customization To customize the workflow: 1. **Change trigger branches**: Modify the `branches` filter in the `on` section 2. **Adjust Go version**: Update the `go-version` in the setup-go step 3. **Modify build arguments**: Add build-args to the docker/build-push-action if needed 4. **Change registry**: Update the REGISTRY environment variable and corresponding secrets ## Example Configuration For Docker Hub: - REGISTRY: `docker.io` - IMAGE_NAME: `yourusername/naviwatcher` For GitHub Container Registry: - REGISTRY: `ghcr.io` - IMAGE_NAME: `username/naviwatcher` For GitLab Container Registry: - REGISTRY: `registry.gitlab.com` - IMAGE_NAME: `group/project/naviwatcher` ## Troubleshooting If builds fail: 1. Check that all required secrets are set correctly 2. Verify you have push permissions to the target registry 3. Ensure Dockerfile is valid and builds locally 4. Check the Actions tab in Gitea for detailed logs