diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7beb393..002cd30 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,13 +1,8 @@ -name: Deploy site +name: Deploy to GitHub Pages on: push: - branches: [main, master] - paths: - - 'web/**' - - 'src/**' - - 'package.json' - - '.github/workflows/deploy.yml' + branches: [main] workflow_dispatch: permissions: @@ -17,37 +12,41 @@ permissions: concurrency: group: pages - cancel-in-progress: true + cancel-in-progress: false jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: Setup Node + uses: actions/setup-node@v4 with: - node-version: '24' + node-version: '20' + cache: 'npm' - - name: Install library dependencies - run: npm install + - name: Install dependencies + run: npm ci - - name: Test library - run: npm test -- --run + - name: Build library + run: npm run build - - name: Install site dependencies - working-directory: web - run: npm install + - name: Install web dependencies + working-directory: ./web + run: npm ci - - name: Build site - working-directory: web + - name: Build web + working-directory: ./web run: npm run build + env: + BASE_PATH: '/funcio/' - - uses: actions/configure-pages@v5 - - - uses: actions/upload-pages-artifact@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 with: - path: web/dist + path: ./web/dist deploy: needs: build @@ -58,4 +57,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/web/index.html b/web/index.html index e103d12..e295f0c 100644 --- a/web/index.html +++ b/web/index.html @@ -37,7 +37,7 @@ - +
diff --git a/web/package.json b/web/package.json index d1f95f1..c344a90 100644 --- a/web/package.json +++ b/web/package.json @@ -9,7 +9,7 @@ "prebuild": "npm --prefix .. run build", "pretypecheck": "npm --prefix .. run build", "build": "npm run verify && tsc --noEmit -p tsconfig.json && npm run lint && vite build", - "postbuild": "tsx scripts/generate-sitemap.ts", + "postbuild": "tsx scripts/generate-sitemap.ts && tsx scripts/update-version.ts", "preview": "vite preview", "typecheck": "tsc --noEmit -p tsconfig.json", "verify": "esbuild scripts/verify-examples.ts --bundle --platform=node --format=esm --log-level=warning --alias:funcio=../src/main.ts --outfile=node_modules/.cache/verify.mjs && node node_modules/.cache/verify.mjs", diff --git a/web/scripts/update-version.ts b/web/scripts/update-version.ts new file mode 100644 index 0000000..1c376ba --- /dev/null +++ b/web/scripts/update-version.ts @@ -0,0 +1,41 @@ +import { readFileSync, writeFileSync } from 'node:fs' +import { resolve } from 'node:path' + +async function getLatestVersion(): Promise