first commit
This commit is contained in:
commit
69b647145f
58 files changed
+15796
No files matched your search
@@ -0,0 +1,91 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Type-check & Build
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DATABASE_URL: file:./data/sejong.db
|
||||
JWT_SECRET: ci-build-placeholder
|
||||
ADMIN_USERNAME: admin
|
||||
ADMIN_PASSWORD: admin
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Prisma migrate (sqlite for build)
|
||||
run: |
|
||||
mkdir -p data
|
||||
npx prisma migrate deploy
|
||||
|
||||
- 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
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Job image often has no docker binary; host sock may already be mounted by act_runner.
|
||||
- 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"
|
||||
if [ -S /var/run/docker.sock ]; then
|
||||
docker info
|
||||
docker version
|
||||
exit 0
|
||||
fi
|
||||
echo "Host /var/run/docker.sock is not available in this job."
|
||||
echo "On act_runner, set container.docker_host: \"\" (use host Docker)"
|
||||
echo "and/or container.valid_volumes: [/var/run/docker.sock]"
|
||||
ls -la /var/run/docker.sock || true
|
||||
docker info || true
|
||||
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-tv:latest
|
||||
docker.sejong.dev/sejong-tv:sha-${{ github.sha }}
|
||||
|
||||
- name: Log out of registry
|
||||
if: always()
|
||||
run: docker logout docker.sejong.dev
|
||||
Reference in new issue
Block a user