Skip to content

Commit

Permalink
feat: ✨ build docs step moved out from ci
Browse files Browse the repository at this point in the history
  • Loading branch information
AkashRajpurohit committed Mar 25, 2024
1 parent c0e3c40 commit 8c2db5a
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 55 deletions.
55 changes: 2 additions & 53 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: CI ⚙️

on:
push:
Expand Down Expand Up @@ -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/[email protected]
with:
commit_message: 'docs: :rocket: docs updated [skip ci]'
commit_user_name: FindingAkash
commit_user_email: [email protected]
commit_author: FindingAkash <[email protected]>
run: pnpm semantic-release
67 changes: 67 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8c2db5a

Please sign in to comment.