# Gitea Actions setup This project builds automatically with Gitea Actions when changes are pushed to the `master` branch. The workflow is defined in `.gitea/workflows/ci.yml`. On pushes to `master`, the workflow also deploys the API with Docker Compose. ## One-time Gitea server setup 1. Make sure the Gitea server is version 1.19.0 or newer. 2. If the server is older than 1.21.0, enable Actions in `app.ini`: ```ini [actions] ENABLED = true ``` 3. Restart Gitea after changing `app.ini`. 4. In the repository settings, enable repository Actions. 5. Register at least one Gitea runner for the instance, organization, or repository. ## Runner setup Install Docker on the runner host, then register a runner with a token from: - Instance runner: `http://git.fshcomputer.dk:3000/-/admin/actions/runners` - Repository runner: `http://git.fshcomputer.dk:3000///settings/actions/runners` Example: ```bash ./act_runner register --no-interactive \ --instance http://git.fshcomputer.dk:3000 \ --token ./act_runner daemon ``` The build job uses the `ubuntu-latest` runner label and installs .NET 10 with `actions/setup-dotnet@v4`. The deploy job uses a separate `deploy-host` runner label so Docker Compose runs directly on the Ubuntu host. The runner must be able to reach `github.com`/`gitea.com` for actions and `api.nuget.org` for packages unless you configure a local action/package mirror. Gitea Actions currently treats `actions/upload-artifact@v4` as unsupported in this environment, so the workflow intentionally uses `actions/upload-artifact@v3`. ## Deployment setup The runner needs a host execution label for deployment: ```bash sudo systemctl stop act_runner sudo -u act_runner /opt/act_runner/act_runner register \ --no-interactive \ --instance http://git.fshcomputer.dk:3000 \ --token \ --name ubuntu-runner \ --labels ubuntu-latest:docker://node:20-bookworm,ubuntu-22.04:docker://node:20-bookworm,deploy-host:host sudo systemctl start act_runner ``` The deploy host also needs Docker Compose: ```bash sudo apt update sudo apt install -y docker-compose-plugin docker compose version ``` Add these repository secrets in Gitea before the first deploy: - `HUNTAPI_HTTP_PORT`, for example `8080` - `HUNTAPI_CONNECTION_STRING` - `HUNTAPI_JWT_SECRET` - `HUNTAPI_JWT_ISSUER`, for example `hunting-app-api` - `HUNTAPI_JWT_AUDIENCE`, for example `hunting-app` Use the PostgreSQL server hostname in the connection string, for example `Host=pgsql.fshcomputer.dk;Port=5432;Database=hunting_app;...`. ## First push The local repository currently needs its first commit and a `master` branch for this workflow to trigger: ```bash git branch -M master git add . git commit -m "Add Gitea CI workflow" git push -u origin master ``` After the push, open the repository's Actions tab in Gitea.