From 7b4dd98593203b773c917448961b36fef4377c7d Mon Sep 17 00:00:00 2001 From: Simon Reinisch Date: Sat, 18 Jan 2025 17:08:59 +0100 Subject: [PATCH] chore: add docs deployment workflow and update workflows --- .github/workflows/deploy.yml | 63 ++++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 45 ++++++++++++++++++++++---- README.md | 4 +++ package.json | 2 +- 4 files changed, 106 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..489d156 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,63 @@ +name: Deploy Docs + +on: + push: + branches: [master] + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + name: Build docs + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up pnpm + uses: pnpm/action-setup@v3 + with: + version: 9.15.0 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: Setup Pages + uses: actions/configure-pages@v4 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build libraries + run: pnpm build + + - name: Build docs + run: pnpm docs:build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs/.vitepress/dist + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: build + runs-on: ubuntu-22.04 + name: Deploy + steps: + - name: Deploy to GitHub Pages + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 06c1011..c2a7257 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,14 +5,17 @@ on: ["push", "pull_request"] jobs: build: name: Build, test and eventually publish - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v3 + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up pnpm + uses: pnpm/action-setup@v3 with: - version: 9.11.0 + version: 9.15.0 - name: Set up Node.js uses: actions/setup-node@v4 @@ -31,13 +34,41 @@ jobs: key: ${{ runner.os }}-eslint-${{ hashFiles('**/pnpm-lock.yaml', '**/eslint.config.mjs') }} - name: Lint - run: pnpm run lint + run: pnpm lint - - name: Build - run: pnpm run build + - name: Build packages + run: pnpm build + + - name: Build docs + run: pnpm docs:build - name: Publish if: startsWith(github.event.ref, 'refs/tags/v') env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} run: npx lerna publish from-package --yes + + publish_release: + if: startsWith(github.event.ref, 'refs/tags/v') + name: Publish new release + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + + - name: Extract changes + id: changelog + uses: requarks/changelog-action@v1 + with: + token: ${{ github.token }} + tag: ${{ github.ref_name }} + + - name: Publish release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + body: ${{ steps.changelog.outputs.changes }} diff --git a/README.md b/README.md index 3e1867c..f864580 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,10 @@ ### Getting started +> [!NOTE] +> I'm currently in the middle of moving the migration from readmes to a new docs websites. +> Stay tuned for a better, more detailed documentation in the coming weeks! + Check out the documentation for the package you want to use: * [@viselect/vanilla](packages/vanilla) - To be used with plain [JavaScript](http://vanilla-js.com/) or [TypeScript](https://www.typescriptlang.org/). diff --git a/package.json b/package.json index bc3e49c..23efcfe 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "author": "Simon Reinisch ", "private": true, "license": "MIT", - "packageManager": "pnpm@9.11.0", + "packageManager": "pnpm@9.15.0", "engines": { "node": "^22" },