From ed29e6788edb3df746089c3e3cb02a1056a9a984 Mon Sep 17 00:00:00 2001 From: "Max T. Kristiansen" Date: Sun, 28 Jul 2024 18:37:43 +0200 Subject: [PATCH] ci(docs): Add workflows for deploying to Github Pages --- .github/workflows/deploy-docs.yml | 58 +++++++++++++++++++++++++++++++ .github/workflows/test-docs.yml | 35 +++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 .github/workflows/deploy-docs.yml create mode 100644 .github/workflows/test-docs.yml diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 0000000..e26910a --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,58 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json + +name: Deploy docs to Github Pages + +on: + push: + branches: + - main + paths: + - 'docs/**' + +defaults: + run: + working-directory: docs/ + +jobs: + build: + name: Build Docusaurus + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Build website + run: npm run build + + - name: Upload Build Artifact + uses: actions/upload-pages-artifact@v3 + with: + path: build + + deploy: + name: Deploy to GitHub Pages + needs: build + + 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 \ No newline at end of file diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml new file mode 100644 index 0000000..867aa68 --- /dev/null +++ b/.github/workflows/test-docs.yml @@ -0,0 +1,35 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json + +name: Test docs + +on: + pull_request: + branches: + - main + paths: + - 'docs/**' + +defaults: + run: + working-directory: ./docs/ + +jobs: + build: + name: Build Docusaurus + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Build website + run: npm run build \ No newline at end of file