100 lines
2.3 KiB
Markdown
100 lines
2.3 KiB
Markdown
# Gitea Actions Workflows
|
|
|
|
## Workflows
|
|
|
|
### 1. CI (`ci.yml`)
|
|
**Triggers:** Push/PR to `main`, `rewrite`, `feat` branches
|
|
|
|
**Jobs:**
|
|
- Install dependencies
|
|
- Lint code
|
|
- Build application
|
|
- Run unit tests (Vitest)
|
|
- Run E2E tests (Playwright)
|
|
- Upload test results as artifacts
|
|
|
|
### 2. Docker Build (`docker-build.yml`)
|
|
**Triggers:**
|
|
- Tags matching `v*` (e.g., `v1.0.0`)
|
|
- Push to `main` branch
|
|
|
|
**Jobs:**
|
|
- Build React application
|
|
- Build Docker image locally
|
|
- Save image as tarball artifact
|
|
- Upload artifact for download (30 days retention)
|
|
|
|
**Output:**
|
|
- Docker image artifact: `configucci.tar`
|
|
- Can be downloaded and loaded with: `docker load -i configucci.tar`
|
|
|
|
### 3. Deploy (`deploy.yml`)
|
|
**Triggers:** Push to `main` branch
|
|
|
|
**Jobs:**
|
|
- Build React application
|
|
- Build Docker image locally
|
|
- Create docker-compose.yml configuration
|
|
- Deploy container on Gitea runner (port 11088)
|
|
- Health check to verify application is running
|
|
- Cleanup old Docker images
|
|
|
|
**No SSH required** - Everything runs natively on the Gitea Actions runner!
|
|
|
|
**Output:**
|
|
- Application available at: `http://<gitea-server>:11088`
|
|
- Container auto-restarts on failure
|
|
- Health check ensures successful deployment
|
|
|
|
## Setup Instructions
|
|
|
|
### 1. Enable Gitea Actions
|
|
Make sure Actions is enabled in your Gitea instance:
|
|
```ini
|
|
[actions]
|
|
ENABLED = true
|
|
```
|
|
|
|
### 2. Configure Runner
|
|
Ensure your Gitea runner has Docker and docker-compose installed:
|
|
|
|
```bash
|
|
# Install Docker
|
|
curl -fsSL https://get.docker.com | sh
|
|
|
|
# Install docker-compose
|
|
sudo apt-get install docker-compose-plugin
|
|
```
|
|
|
|
**No secrets required** - Everything runs on the runner!
|
|
|
|
## Workflow Files Location
|
|
`.gitea/workflows/`
|
|
|
|
## Testing Workflows Locally
|
|
|
|
You can test workflows locally using [act](https://github.com/nektos/act):
|
|
|
|
```bash
|
|
# Install act
|
|
brew install act
|
|
|
|
# Run CI workflow locally
|
|
act push
|
|
|
|
# Run with specific job
|
|
act -j build-and-test
|
|
|
|
# Run with verbose output
|
|
act -v
|
|
```
|
|
|
|
## Badge Examples
|
|
|
|
Add these to your README.md:
|
|
|
|
```markdown
|
|
[](https://git.six83.ru/ssa/configucci/actions/workflows/ci.yml)
|
|
[](https://git.six83.ru/ssa/configucci/actions/workflows/deploy.yml)
|
|
```
|