diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml new file mode 100644 index 0000000..bdfba1d --- /dev/null +++ b/.github/actions/setup-node/action.yml @@ -0,0 +1,18 @@ +name: Setup Node.js +description: Setup Node.js and install dependencies + +inputs: + node-version: + description: Node.js version to use + required: false + default: '22' + +runs: + using: composite + steps: + - uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + cache: 'npm' + - run: npm ci + shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e035fa..3dec01d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,41 +10,40 @@ permissions: contents: read jobs: - quality: + lint: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [22] - steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-node + - run: npm run lint - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - - name: Install dependencies - run: npm ci - - - name: Lint - run: npm run lint - - - name: Type check - run: npm run type-check + type-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-node + - run: npm run type-check - - name: Test - run: npm run test -- --run + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-node + - run: npm run test -- --run - - name: Build - run: npm run build + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-node + - run: npm run build env: NEXT_PUBLIC_API_URL: http://localhost:8000 + NEXT_PUBLIC_WS_URL: ws://localhost:8000 publish_github: if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/ontokit-web-') - needs: [quality] + needs: [lint, type-check, test, build] runs-on: ubuntu-latest permissions: contents: write @@ -55,7 +54,7 @@ jobs: publish_docker: if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/ontokit-web-') - needs: [quality] + needs: [lint, type-check, test, build] runs-on: ubuntu-latest permissions: contents: read @@ -82,8 +81,5 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - build-args: | - NEXT_PUBLIC_API_URL= - NEXT_PUBLIC_WS_URL= cache-from: type=gha cache-to: type=gha,mode=max diff --git a/README.md b/README.md index 887d80a..10d9446 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # OntoKit Web +[![Lint](https://github.com/CatholicOS/ontokit-web/actions/workflows/release.yml/badge.svg?event=push)](https://github.com/CatholicOS/ontokit-web/actions/workflows/release.yml) +[![Node.js](https://img.shields.io/badge/node-%3E%3D20.9.0-brightgreen?logo=node.js)](https://nodejs.org/) +[![Next.js](https://img.shields.io/badge/Next.js-15-black?logo=next.js)](https://nextjs.org/) +[![React](https://img.shields.io/badge/React-19-61dafb?logo=react)](https://react.dev/) +[![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript)](https://www.typescriptlang.org/) +[![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?logo=docker)](https://github.com/CatholicOS/ontokit-web/pkgs/container/ontokit-web) + The web frontend for OntoKit - a collaborative OWL ontology curation platform. ## Features diff --git a/lib/env.ts b/lib/env.ts index 7b61445..e0d1d50 100644 --- a/lib/env.ts +++ b/lib/env.ts @@ -40,8 +40,8 @@ function validateServerEnv(): ServerEnv { function validateClientEnv(): ClientEnv { const raw = { - NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8000", - NEXT_PUBLIC_WS_URL: process.env.NEXT_PUBLIC_WS_URL, + NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL || undefined, + NEXT_PUBLIC_WS_URL: process.env.NEXT_PUBLIC_WS_URL || undefined, }; const result = clientSchema.safeParse(raw); if (!result.success) {