name: CI on: push: branches: - main pull_request: branches: - main workflow_dispatch: jobs: check: runs-on: shell steps: - name: Typecheck, lint, and test run: | set -e WORK="$(mktemp -d /var/tmp/epicnext-ci.XXXXXX)" cleanup() { rm -rf "${WORK}"; } trap cleanup EXIT echo "--- CI checks (${WORK}) ---" git clone --depth 50 \ /docker/gitea/gitea/git/repositories/remco/epicnext-cms.git \ "${WORK}" cd "${WORK}" REF="${{ gitea.sha }}" if [ -z "${REF}" ]; then echo "ERROR: missing gitea.sha" >&2 exit 1 fi git fetch --depth 50 origin "${REF}" git checkout -f "${REF}" export SKIP_ENV_VALIDATION=1 export NODE_ENV=test export DATABASE_URL="mysql://test:test@localhost:3306/test?charset=utf8mb4" export AUTH_SECRET="ci-test-secret-key-that-is-long-enough" export REDIS_URL="redis://127.0.0.1:6379?connect_timeout=1" export BCRYPT_ROUNDS=4 pnpm install --frozen-lockfile pnpm prisma:generate pnpm biome:lint pnpm typecheck pnpm test echo "--- CI checks passed ---" deploy: if: github.ref == 'refs/heads/main' && github.event_name == 'push' runs-on: shell needs: check steps: - name: Build and deploy run: | set -e WORK="$(mktemp -d /var/tmp/epicnext-deploy.XXXXXX)" cleanup() { rm -rf "${WORK}"; } trap cleanup EXIT echo "--- Deploy (${WORK}) ---" git clone --depth 50 \ /docker/gitea/gitea/git/repositories/remco/epicnext-cms.git \ "${WORK}" cd "${WORK}" REF="${{ gitea.sha }}" git fetch --depth 50 origin "${REF}" git checkout -f "${REF}" export NODE_ENV=production export SKIP_ENV_VALIDATION=1 pnpm install --frozen-lockfile pnpm prisma:generate pnpm build pm2 restart next --update-env pm2 save echo "--- Deploy complete ---"