Files
website/.gitea/workflows/ci.yml
T
Christian Manivong 403551a50d
CI / TypeScript — type-check (push) Successful in 8s
CI / Publish — build & push image (push) Successful in 7s
CI / Deploy — pull & restart on host (push) Successful in 2s
ci: move deploy to ubuntu-latest — fixes needs ordering with build runner
2026-06-28 10:47:48 +02:00

74 lines
2.0 KiB
YAML

name: CI
on:
push:
branches: ['**']
tags: ['v*']
pull_request:
branches: ['**']
jobs:
typecheck:
name: TypeScript — type-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install
run: npm ci
- name: Type-check (tsc)
run: npx tsc --noEmit
publish:
name: Publish — build & push image
runs-on: ubuntu-latest
needs: [typecheck]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Login to registry
run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login registry.netork.io -u "${{ secrets.REGISTRY_USER }}" --password-stdin
- name: Build & push
run: |
SHA=$(git rev-parse --short HEAD)
docker build \
-t registry.netork.io/netork/website:latest \
-t registry.netork.io/netork/website:main-${SHA} \
.
docker push registry.netork.io/netork/website:latest
docker push registry.netork.io/netork/website:main-${SHA}
- name: Logout
if: always()
run: docker logout registry.netork.io
deploy:
name: Deploy — pull & restart on host
runs-on: ubuntu-latest
needs: [publish]
steps:
- name: Login to registry
run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login registry.netork.io -u "${{ secrets.REGISTRY_USER }}" --password-stdin
- name: Pull & restart
run: |
docker pull registry.netork.io/netork/website:latest
docker rm -f netork-website 2>/dev/null || true
docker run -d \
--name netork-website \
--restart unless-stopped \
--network proxy-net \
registry.netork.io/netork/website:latest
- name: Logout
if: always()
run: docker logout registry.netork.io