From 8c2db5ade6d0e5b8304829c855341b54991d0efb Mon Sep 17 00:00:00 2001 From: AkashRajpurohit Date: Mon, 25 Mar 2024 09:17:07 +0530 Subject: [PATCH] feat: :sparkles: build docs step moved out from ci --- .github/workflows/CI.yml | 55 ++----------------------------- .github/workflows/docs.yml | 67 ++++++++++++++++++++++++++++++++++++++ README.md | 2 -- 3 files changed, 69 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4376e0f..44efa61 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,4 +1,4 @@ -name: CI +name: CI ⚙️ on: push: @@ -136,55 +136,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: pnpm semantic-release - - build_docs: - runs-on: ubuntu-latest - permissions: - contents: write - id-token: write - needs: [release] - steps: - - name: Checkout 🧳 - uses: actions/checkout@v4 - - - name: Install Node.js 🔥 - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Install pnpm 👀 - uses: pnpm/action-setup@v3 - id: pnpm-install - with: - version: 8 - run_install: false - - - name: Get pnpm store directory 🏪 - id: pnpm-cache - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - - - name: Setup pnpm cache 💰 - uses: actions/cache@v4 - with: - path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies ⏬ - run: pnpm install --no-frozen-lockfile - - - name: Build Docs ⏰ - run: pnpm build:docs - - - name: Commit and Push 🚀 - if: always() - uses: stefanzweifel/git-auto-commit-action@v5.0.0 - with: - commit_message: 'docs: :rocket: docs updated [skip ci]' - commit_user_name: FindingAkash - commit_user_email: bot@akashrajpurohit.com - commit_author: FindingAkash \ No newline at end of file + run: pnpm semantic-release \ No newline at end of file diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..4a3a4b8 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,67 @@ +name: Build and Deploy Docs 📚 + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout 🧳 + uses: actions/checkout@v4 + + - name: Install Node.js 🔥 + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install pnpm 👀 + uses: pnpm/action-setup@v3 + id: pnpm-install + with: + version: 8 + run_install: false + + - name: Get pnpm store directory 🏪 + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - name: Setup pnpm cache 💰 + uses: actions/cache@v4 + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies ⏬ + run: pnpm install --no-frozen-lockfile + + - name: Build Docs ⏰ + run: pnpm run build:docs + + - name: Upload Pages Artifact ☁️ + uses: actions/upload-pages-artifact@v2 + id: deployment + with: + path: ./docs # This should be your TypeDoc "out" path. + + deploy: + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: build + steps: + - name: Deploy to GitHub Pages 🚀 + id: deployment + uses: actions/deploy-pages@v2 \ No newline at end of file diff --git a/README.md b/README.md index 1591560..a3b98c7 100644 --- a/README.md +++ b/README.md @@ -85,8 +85,6 @@ The project is configured to auto-generate the documentation using [typedoc](htt You can enable github pages to serve the documentation by following the steps mentioned in the [github pages documentation](https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-github-pages-site). -As part of the CI pipeline, the documentation is generated and pushed to the `main` branch with `[skip ci]` commit message so the new release is not triggered. The commit is generated from the Github user `FindingAkash` which is a bot user. You can change the user by updating the [workflow file](./.github/workflows/ci.yml). - ## Technology stack 🚀 - 🙏🏾 [Typescript](https://www.typescriptlang.org/) with [tsup](https://tsup.egoist.dev/) build tool.