2.8 KiB
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
-
Make sure the Gitea server is version 1.19.0 or newer.
-
If the server is older than 1.21.0, enable Actions in
app.ini:[actions] ENABLED = true -
Restart Gitea after changing
app.ini. -
In the repository settings, enable repository Actions.
-
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/<owner>/<repo>/settings/actions/runners
Example:
./act_runner register --no-interactive \
--instance http://git.fshcomputer.dk:3000 \
--token <runner-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:
sudo systemctl stop act_runner
sudo -u act_runner /opt/act_runner/act_runner register \
--no-interactive \
--instance http://git.fshcomputer.dk:3000 \
--token <runner-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:
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 example8080HUNTAPI_CONNECTION_STRINGHUNTAPI_JWT_SECRETHUNTAPI_JWT_ISSUER, for examplehunting-app-apiHUNTAPI_JWT_AUDIENCE, for examplehunting-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:
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.