From 8fbc621f50d7d4c509bd95f97950faab0db66375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Teles?= Date: Wed, 11 Dec 2024 08:55:40 -0300 Subject: [PATCH] ci: automate documentation build and deployment to GitHub Pages --- .github/workflows/publish.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a89d389..730e104 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -35,3 +35,25 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} run: npx semantic-release + + - name: Build documentation + run: npm run docs:build + + - name: Checkout documentation repo + run: | + git clone https://github.com/holy-sheets/holy-sheets.github.io.git docs-site + + - name: Copy generated docs to gh-pages repo + run: | + rm -rf docs-site/* + cp -R docs/.vitepress/dist/* docs-site/ + cd docs-site + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "docs: update site from main repo" + + - name: Push to gh-pages + run: | + cd docs-site + git push https://${{ secrets.GITHUB_TOKEN }}@github.com/holy-sheets/holy-sheets.github.io.git main:main