Skip to main content

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 SettingsActions. 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

name: Workflow display nameon: Event triggers that start the workflow
  • push: When code is pushed
  • pull_request: When PR is created/updated
  • schedule: Cron-based scheduling
  • workflow_dispatch: Manual trigger
  • release: When release is published
jobs: Individual units of work
  • Run in parallel by default
  • Can have dependencies
  • Each runs in fresh environment
steps: Sequential tasks within a job
  • 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:
Use custom action:

Secrets and Variables

Repository Secrets

Store sensitive data securely:
1

Add Secrets

Navigate to SettingsSecrets 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

Best Practices

Performance
  • Use caching for dependencies
  • Run jobs in parallel when possible
  • Use matrix builds efficiently
  • Clean up artifacts regularly
Security
  • Store secrets securely
  • Limit secret exposure
  • Use minimal permissions
  • Pin action versions
  • Review third-party actions
Maintainability
  • Use descriptive job and step names
  • Document complex workflows
  • Reuse workflows with templates
  • Keep workflows DRY (Don’t Repeat Yourself)
  • Version control workflow files
Reliability
  • Handle failures gracefully
  • Use appropriate timeouts
  • Add retry logic for flaky tests
  • Monitor workflow execution
  • Set up failure notifications

See Also