feat: add Gitea Actions CI/CD workflows
Some checks failed
CI / build-and-test (push) Has been cancelled
Some checks failed
CI / build-and-test (push) Has been cancelled
This commit is contained in:
112
.gitea/workflows/README.md
Normal file
112
.gitea/workflows/README.md
Normal file
@@ -0,0 +1,112 @@
|
||||
# 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
|
||||
- Push to Docker registry
|
||||
|
||||
**Required Secrets:**
|
||||
- `DOCKER_USERNAME` - Docker registry username
|
||||
- `DOCKER_PASSWORD` - Docker registry password/token
|
||||
|
||||
**Optional Variables:**
|
||||
- `DOCKER_REGISTRY` - Registry URL (default: `docker.io`)
|
||||
|
||||
### 3. Deploy (`deploy.yml`)
|
||||
**Triggers:** Push to `main` branch
|
||||
|
||||
**Jobs:**
|
||||
- SSH to deployment server
|
||||
- Pull latest code
|
||||
- Update Docker containers
|
||||
- Clean up old images
|
||||
|
||||
**Required Secrets:**
|
||||
- `DEPLOY_HOST` - Server hostname/IP
|
||||
- `DEPLOY_USERNAME` - SSH username
|
||||
- `DEPLOY_KEY` - SSH private key
|
||||
|
||||
**Optional Secrets:**
|
||||
- `DEPLOY_PORT` - SSH port (default: 22)
|
||||
|
||||
## Setup Instructions
|
||||
|
||||
### 1. Enable Gitea Actions
|
||||
Make sure Actions is enabled in your Gitea instance:
|
||||
```ini
|
||||
[actions]
|
||||
ENABLED = true
|
||||
```
|
||||
|
||||
### 2. Configure Secrets
|
||||
Go to your repository → Settings → Secrets and add:
|
||||
|
||||
**For Docker Build:**
|
||||
```
|
||||
DOCKER_USERNAME=your-username
|
||||
DOCKER_PASSWORD=your-password-or-token
|
||||
```
|
||||
|
||||
**For Deployment:**
|
||||
```
|
||||
DEPLOY_HOST=your-server.com
|
||||
DEPLOY_USERNAME=deploy
|
||||
DEPLOY_KEY=<paste-ssh-private-key>
|
||||
DEPLOY_PORT=22
|
||||
```
|
||||
|
||||
### 3. Configure Variables (Optional)
|
||||
Go to your repository → Settings → Variables and add:
|
||||
|
||||
```
|
||||
DOCKER_REGISTRY=registry.example.com
|
||||
```
|
||||
|
||||
## 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/docker-build.yml)
|
||||
[](https://git.six83.ru/ssa/configucci/actions/workflows/deploy.yml)
|
||||
```
|
||||
Reference in New Issue
Block a user