huntapi/.gitea/workflows/ci.yml
Finn Skov Henriksen 4362d4ca26
All checks were successful
Build / Restore, build and publish (push) Successful in 52s
Build / Build and run Docker container (push) Successful in 59s
ci update
2026-08-31 14:05:09 +02:00

63 lines
1.5 KiB
YAML

name: Build
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
build:
name: Restore, build and publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore
run: dotnet restore HuntingAppApi.csproj
- name: Build
run: dotnet build HuntingAppApi.csproj --configuration Release --no-restore
- name: Publish
run: dotnet publish HuntingAppApi.csproj --configuration Release --no-build --output ./artifacts/huntapi
- name: Upload published API
uses: actions/upload-artifact@v3
with:
name: huntapi
path: ./artifacts/huntapi
deploy:
name: Build and run Docker container
runs-on: docker
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Write environment file
run: |
cat > .env <<'EOF'
HUNTAPI_HTTP_PORT=${{ secrets.HUNTAPI_HTTP_PORT }}
HUNTAPI_CONNECTION_STRING=${{ secrets.HUNTAPI_CONNECTION_STRING }}
HUNTAPI_JWT_SECRET=${{ secrets.HUNTAPI_JWT_SECRET }}
HUNTAPI_JWT_ISSUER=${{ secrets.HUNTAPI_JWT_ISSUER }}
HUNTAPI_JWT_AUDIENCE=${{ secrets.HUNTAPI_JWT_AUDIENCE }}
EOF
- name: Deploy
run: docker compose up -d --build --remove-orphans