92 lines
2.3 KiB
YAML
92 lines
2.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
name: Type-check & Build
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
# CAD/OCR/3D viewer assets make Vite exceed the default ~2GB heap
|
|
NODE_OPTIONS: --max-old-space-size=8192
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: npm
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Type-check and build
|
|
run: npm run build
|
|
|
|
image:
|
|
name: Build & Push image
|
|
needs: build
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
DOCKER_HOST: tcp://docker:2375
|
|
DOCKER_TLS_CERTDIR: ""
|
|
services:
|
|
docker:
|
|
image: docker:27-dind
|
|
env:
|
|
DOCKER_TLS_CERTDIR: ""
|
|
options: --privileged --shm-size=2gb
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Docker CLI
|
|
run: |
|
|
mkdir -p "$HOME/.local/bin"
|
|
curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-27.5.1.tgz \
|
|
| tar xz --strip-components=1 -C "$HOME/.local/bin" docker/docker
|
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
for i in $(seq 1 60); do
|
|
if docker info >/dev/null 2>&1; then
|
|
docker version
|
|
exit 0
|
|
fi
|
|
sleep 2
|
|
done
|
|
echo "DinD did not become ready in time"
|
|
docker info
|
|
exit 1
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: docker.sejong.dev
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
docker.sejong.dev/sejong-office:latest
|
|
docker.sejong.dev/sejong-office:sha-${{ github.sha }}
|
|
|
|
- name: Log out of registry
|
|
if: always()
|
|
run: docker logout docker.sejong.dev
|