From 1a69aaef4995df1ca925a4785ea1b02f9c414e79 Mon Sep 17 00:00:00 2001 From: Colin Espinas Date: Wed, 21 Aug 2024 21:59:51 +0200 Subject: [PATCH] fix: documentation generation and deployment --- .github/workflows/docs.yml | 126 ++++++++++++++++++++----------------- 1 file changed, 68 insertions(+), 58 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ae65500..4349d67 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,63 +2,73 @@ name: Documentation generation on: push: branches: - - main + - fix/documentation jobs: -# build-and-test: -# name: Build and test project before generating documentation -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v2 -# - name: Use Node.js LTS -# uses: actions/setup-node@v2 -# with: -# node-version: lts/* -# - name: Cache node modules -# uses: actions/cache@v2 -# env: -# cache-name: cache-node-modules -# with: -# path: ~/.npm -# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} -# restore-keys: | -# ${{ runner.os }}-build-${{ env.cache-name }}- -# ${{ runner.os }}-build- -# ${{ runner.os }}- -# - name: Install dependencies -# run: npm ci --prefer-offline -# - name: Build project -# run: npm run build -# - name: Lint project code -# run: npm run lint + build-and-test: + name: Build and lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 -# build-docs: -# name: Build and deploy documentation -# runs-on: ubuntu-latest -# needs: [build-and-test] -# steps: -# - uses: actions/checkout@v2 -# - name: Use Node.js LTS -# uses: actions/setup-node@v2 -# with: -# node-version: lts/* -# - name: Cache node modules -# uses: actions/cache@v2 -# env: -# cache-name: cache-node-modules -# with: -# path: ~/.npm -# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} -# restore-keys: | -# ${{ runner.os }}-build-${{ env.cache-name }}- -# ${{ runner.os }}-build- -# ${{ runner.os }}- -# - name: Install dependencies -# run: npm ci --prefer-offline -# - name: Generate documentation -# run: npm run docs -# - name: Deploy to GitHub Pages -# uses: peaceiris/actions-gh-pages@v3 -# with: -# github_token: ${{ secrets.GITHUB_TOKEN }} -# publish_dir: ./docs -# publish_branch: docs + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Use Node.js LTS + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: pnpm + + - name: Install dependencies + run: pnpm install + + - name: Build + run: pnpm build + + - name: Lint + run: pnpm lint + + build-docs: + name: Build and deploy documentation + runs-on: ubuntu-latest + needs: [build-and-test] + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Use Node.js LTS + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: pnpm + + - name: Install dependencies + run: pnpm install + + - name: Generate documentation + run: pnpm docs:generate + + - name: Upload GitHub Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs + + deploy-docs: + needs: build-docs + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4