Overview
Gitea Actions is a built-in CI/CD system that enables automated workflows for building, testing, and deploying your code. With GitHub Actions compatibility, you can reuse existing workflows and actions from the broader ecosystem.Key Features
GitHub Actions Compatible
- Reuse GitHub Actions workflows
- Use actions from marketplace
- Compatible YAML syntax
- Familiar workflow patterns
Self-Hosted Runners
- Run on your infrastructure
- Full control over environment
- Custom runner labels
- Secure execution
Matrix Builds
- Test multiple versions
- Cross-platform builds
- Parallel execution
- Efficient resource usage
Workflow Automation
- Event-driven triggers
- Scheduled workflows
- Manual dispatch
- Conditional execution
Getting Started
1
Enable Actions
Repository administrators must enable Actions in Settings → Actions. Instance administrators must enable Actions in the Gitea configuration.
2
Create Workflow File
Create
.gitea/workflows/ or .github/workflows/ directory in your repository:3
Define Workflow
Write your workflow configuration in YAML format
4
Commit and Push
Commit the workflow file and push to trigger execution:
Workflow Syntax
Basic Workflow
Workflow Components
Workflow Structure
Workflow Structure
name: Workflow display nameon: Event triggers that start the workflow
push: When code is pushedpull_request: When PR is created/updatedschedule: Cron-based schedulingworkflow_dispatch: Manual triggerrelease: When release is published
- Run in parallel by default
- Can have dependencies
- Each runs in fresh environment
- Execute in order
- Share job environment
- Can use actions or run commands
Action Run Model
Triggers
Push Events
Pull Request Events
Scheduled Workflows
Manual Dispatch
Jobs and Steps
Job Dependencies
Matrix Strategy
Conditional Execution
Using Actions
Built-in Actions
Custom Actions
Create reusable actions in your repository or organization:Secrets and Variables
Repository Secrets
Store sensitive data securely:1
Add Secrets
Navigate to Settings → Secrets and add secrets like API keys, tokens, and passwords
2
Use in Workflows
Secrets are encrypted and never exposed in logs. They’re only available to workflows in the repository where they’re defined.
Variables
Context Variables
Access workflow metadata:Runners
Runner Labels
Target specific runners:Self-Hosted Runners
Register custom runners:1
Download Runner
Download the Gitea Actions runner for your platform from the Gitea releases page
2
Register Runner
3
Start Runner
Self-hosted runners can access your internal network and resources. Only use them with trusted repositories.
Artifacts and Caching
Artifacts
Caching Dependencies
Status Badges
Display workflow status in README:Notifications
Gitea Actions integrates with the notification system:Success Notifications
- Workflow completion
- Job success
- Deployment success
- Custom success actions
Failure Notifications
- Build failures
- Test failures
- Deployment errors
- Timeout notifications
Example Workflows
- Node.js CI
- Docker Build
- Go CI
Best Practices
Workflow Optimization
Workflow Optimization
Performance
- Use caching for dependencies
- Run jobs in parallel when possible
- Use matrix builds efficiently
- Clean up artifacts regularly
- Store secrets securely
- Limit secret exposure
- Use minimal permissions
- Pin action versions
- Review third-party actions
- Use descriptive job and step names
- Document complex workflows
- Reuse workflows with templates
- Keep workflows DRY (Don’t Repeat Yourself)
- Version control workflow files
- Handle failures gracefully
- Use appropriate timeouts
- Add retry logic for flaky tests
- Monitor workflow execution
- Set up failure notifications
See Also
- Pull Requests - Integrate Actions with PR workflows
- Packages - Build and publish packages
- Repositories - Repository management