ef0126aaff
API CI/CD / Validate (composer + pint) (push) Failing after 2s
API CI/CD / Test (PHPUnit) (push) Failing after 2s
API CI/CD / Build frontend assets (push) Failing after 39s
API CI/CD / Security audit (push) Failing after 1s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
- Remove --exclude=vendor and pre-install with --no-dev - Download frontend build artifacts before deploy - Add post-deploy artisan commands (migrate, cache, optimize) - Add alpine container for consistent package management
53 lines
1.8 KiB
Markdown
53 lines
1.8 KiB
Markdown
# Gitea CI/CD — Setup Checklist
|
|
|
|
After pushing, the pipeline will run automatically. The following steps are required to unlock all features (especially deploy jobs).
|
|
|
|
## 1. Repository Secrets (Settings → Actions → Secrets)
|
|
|
|
| Secret Name | Description |
|
|
|---|---|
|
|
| `SSH_PASSWORD` | SSH password for the deployment server |
|
|
| `SSH_USER` | SSH username for the deployment server |
|
|
| `SSH_HOST` | IP or domain of the deployment server |
|
|
|
|
## 2. Repository Variables (Settings → Actions → Variables)
|
|
|
|
| Variable Name | Default | Description |
|
|
|---|---|---|
|
|
| `SSH_PORT` | `22` | SSH port for the deployment server |
|
|
| `SSH_TARGET_DIR` | — | Absolute path on the server where the Laravel app root goes |
|
|
| `PRODUCTION_URL` | — | Public URL of the production site |
|
|
|
|
> **Note:** The deploy job runs `php artisan migrate`, `config:cache`, `route:cache`, `view:cache`, and `optimize` via SSH after uploading. The PHP CLI binary must be available on the shared hosting server.
|
|
|
|
## 3. Allow Gitea Actions
|
|
|
|
- Go to **Settings → Actions** in your Gitea repository
|
|
- Ensure **"Actions"** are enabled
|
|
- If using self-hosted runners, ensure a runner is registered and online
|
|
|
|
## 4. Optional: Configure Gitea Actions Runner
|
|
|
|
If no runner is registered yet on your Gitea instance:
|
|
|
|
```bash
|
|
# On the runner machine (Docker-based)
|
|
docker run -d \
|
|
--name gitea-runner \
|
|
-e GITEA_INSTANCE_URL=https://192.168.3.80 \
|
|
-e GITEA_RUNNER_REGISTRATION_TOKEN=<your-registration-token> \
|
|
-e GITEA_RUNNER_NAME=runner-1 \
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
gitea/act_runner:latest
|
|
```
|
|
|
|
## Pipeline Stages
|
|
|
|
| Job | Requires Secrets/Vars | Runs on |
|
|
|---|---|---|
|
|
| `validate` | None | Push & PR |
|
|
| `test` | None | Push & PR |
|
|
| `build` | None | Push & PR |
|
|
| `security` | None | Push & PR |
|
|
| `deploy` | SSH secrets + vars | Manual on `main`/`master` |
|