ci: add lint, coverage check and proper deploy workflow
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: Deploy Production
|
||||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -8,11 +8,18 @@ jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.22'
|
||||
|
||||
- name: Build
|
||||
run: CGO_ENABLED=0 go build -o main ./cmd/api
|
||||
- name: Deploy pulse-api
|
||||
run: |
|
||||
cd /opt/digital-home/homelab-api
|
||||
docker compose pull
|
||||
docker compose up -d --build
|
||||
echo "Waiting for healthcheck..."
|
||||
sleep 5
|
||||
STATUS=$(docker inspect --format='{{.State.Health.Status}}' homelab-api 2>/dev/null || echo "no-healthcheck")
|
||||
echo "Container status: $STATUS"
|
||||
if [ "$STATUS" = "unhealthy" ]; then
|
||||
echo "::error::Container is unhealthy after deploy"
|
||||
docker logs homelab-api --tail=20
|
||||
exit 1
|
||||
fi
|
||||
echo "Deploy successful!"
|
||||
|
||||
Reference in New Issue
Block a user