chore: update generated changelog #166
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI & Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| ci: | |
| name: Typecheck & test | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: api | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - run: bun install --frozen-lockfile | |
| - run: bun run typecheck | |
| - run: bun test | |
| - run: bun run typecheck:web | |
| - run: bun run build:web | |
| deploy: | |
| name: Deploy to homelab | |
| needs: ci | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: [self-hosted, homelab] | |
| timeout-minutes: 15 | |
| concurrency: | |
| group: deploy-homelab | |
| cancel-in-progress: false | |
| steps: | |
| - name: Pull and rebuild | |
| run: | | |
| set -e | |
| git config --global --add safe.directory /home/adrian/dkrypt | |
| cd /home/adrian/dkrypt | |
| git fetch origin main | |
| git merge --ff-only origin/main | |
| docker tag dkrypt:latest dkrypt:previous 2>/dev/null || true | |
| BUILD_REF="$(git rev-parse HEAD)" docker compose build api | |
| docker compose up -d api | |
| - name: Wait for health, roll back on failure | |
| run: | | |
| set -e | |
| for i in $(seq 1 15); do | |
| page=$(curl -sf http://127.0.0.1:8080/ || true) | |
| asset=$(printf '%s' "$page" | grep -oE '/assets/[^" ]+\.js' | head -n 1) | |
| if [ -n "$asset" ] && curl -sf -o /dev/null "http://127.0.0.1:8080$asset"; then | |
| echo "healthy" | |
| exit 0 | |
| fi | |
| sleep 2 | |
| done | |
| echo "service did not become healthy in time" >&2 | |
| docker compose -f /home/adrian/dkrypt/docker-compose.yml logs --tail 50 api | |
| if docker image inspect dkrypt:previous >/dev/null 2>&1; then | |
| echo "rolling back to the previous image" >&2 | |
| docker tag dkrypt:previous dkrypt:latest | |
| docker compose -f /home/adrian/dkrypt/docker-compose.yml up -d api | |
| else | |
| echo "no previous image to roll back to" >&2 | |
| fi | |
| exit 1 |