From 7123867fb9abe2b976edff4ad8a2f203b8c71df2 Mon Sep 17 00:00:00 2001 From: Lawrence Ephrim Date: Fri, 26 Apr 2024 12:02:00 +0000 Subject: [PATCH] docs: add gh pages deploy action --- .github/workflows/deploy.yml | 51 ++++++++++++++++++++++++++++++++++++ docs/docusaurus.config.ts | 7 +++-- 2 files changed, 56 insertions(+), 2 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..f7dedfb --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,51 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - gh-pages + # Review gh actions docs if you want to further define triggers, paths, etc + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on + +jobs: + build: + name: Build Docusaurus + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: npm + + - name: Install dependencies + run: npm clean-install + - name: Build website + run: npm build + + - name: Upload Build Artifact + uses: actions/upload-pages-artifact@v3 + with: + path: build + + deploy: + name: Deploy to GitHub Pages + needs: build + + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + # Deploy to the github-pages environment + 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 diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index 7425751..49ee3db 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -18,12 +18,15 @@ const config: Config = { // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. - organizationName: 'ephrimawrence/ananse', // Usually your GitHub org/user name. + organizationName: 'github.com/ephrimawrence', // Usually your GitHub org/user name. projectName: 'ananse', // Usually your repo name. + deploymentBranch: "gh-pages", + trailingSlash: false, onBrokenLinks: 'throw', onBrokenMarkdownLinks: 'throw', + // Even if you don't use internationalization, you can use this field to set // useful metadata like html lang. For example, if your site is Chinese, you // may want to replace "en" with "zh-Hans". @@ -73,7 +76,7 @@ const config: Config = { type: 'docSidebar', sidebarId: 'tutorialSidebar', position: 'left', - label: 'Guide', + label: 'Docs', }, // { to: '/blog', label: 'Blog', position: 'left' }, {