From ba00424782aadc0df5b7de61cede61f2f728272c Mon Sep 17 00:00:00 2001 From: Daniele Briggi Date: Mon, 25 May 2026 15:59:30 +0200 Subject: [PATCH] fix: publish docs --- .github/workflows/publish-docs.yml | 37 +++++++++++++++++++ .github/workflows/release.yml | 58 ++++++++++++++++++++---------- package.json | 4 +-- 3 files changed, 78 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/publish-docs.yml diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml new file mode 100644 index 0000000..91aa287 --- /dev/null +++ b/.github/workflows/publish-docs.yml @@ -0,0 +1,37 @@ +name: 'Publish docs' +on: + push: + branches: [main] + +permissions: + contents: read + pages: write + id-token: write + +jobs: + build_and_docs: + name: 'Build and Docs' + timeout-minutes: 5 + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: latest + - name: Setup Dependencies + run: | + corepack enable + npm install + - name: Build App and Typedoc + run: | + npm run build + npm run typedoc + - uses: actions/upload-pages-artifact@v3 + with: + path: ./docs + - name: Deploy Typedoc to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9be2d9e..3a1cd00 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,37 +1,57 @@ name: 'Release' + on: - push: - branches: [main] + release: + types: [created] + workflow_dispatch: permissions: contents: read - pages: write id-token: write +concurrency: + group: release + cancel-in-progress: false + jobs: - build_and_docs: - name: 'Build and Docs' - timeout-minutes: 5 + publish: + name: 'Publish to npm' + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && !github.event.release.draft) + timeout-minutes: 10 runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} + steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: latest + node-version: 22.13.1 + registry-url: 'https://registry.npmjs.org' + - name: Setup Dependencies run: | corepack enable npm install - - name: Build App and Typedoc + + - name: Read package version + id: package run: | - npm run build - npm run typedoc - - uses: actions/upload-pages-artifact@v3 - with: - path: ./docs - - name: Deploy Typedoc to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 + echo "version=$(node -p 'require(\"./package.json\").version')" >> "$GITHUB_OUTPUT" + + - name: Validate release tag + if: github.event_name == 'release' + run: | + expected_tag="v${{ steps.package.outputs.version }}" + actual_tag="${{ github.event.release.tag_name }}" + if [ "$actual_tag" != "$expected_tag" ]; then + echo "Release tag $actual_tag does not match package version $expected_tag" + exit 1 + fi + + - name: Build package + run: npm run build + + - name: Publish package + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm publish --access public --provenance diff --git a/package.json b/package.json index f521c95..b6a4006 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sqlitecloud/drivers", - "version": "1.0.872", + "version": "1.0.890", "description": "SQLiteCloud drivers for Typescript/Javascript in edge, web and node clients", "main": "./lib/index.js", "types": "./lib/index.d.ts", @@ -12,7 +12,7 @@ "build": "rm -rf ./lib/ && tsc --project tsconfig.build.json && npx webpack", "publish": "npm run build && npm publish --access public", "prettier": "prettier --write 'src/**/*'", - "typedoc": "rm -rf ./docs/ && typedoc --out docs && typedoc --plugin typedoc-plugin-markdown --out docs/markdown", + "typedoc": "rm -rf ./docs/ && typedoc --tsconfig tsconfig.build.json --out docs && typedoc --tsconfig tsconfig.build.json --plugin typedoc-plugin-markdown --out docs/markdown", "npmgui": "npx npm-gui@latest", "prepare": "husky" },