From 7e31bf26e05675265659909d252a00fdb22d6cc7 Mon Sep 17 00:00:00 2001 From: Matty Stratton Date: Mon, 4 Mar 2024 12:30:32 -0600 Subject: [PATCH 1/2] Add github action for pages Signed-off-by: Matty Stratton --- .../workflows/build-deploy-and-preview.yml | 28 +++++++++++++++++++ docusaurus.config.js | 3 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-deploy-and-preview.yml diff --git a/.github/workflows/build-deploy-and-preview.yml b/.github/workflows/build-deploy-and-preview.yml new file mode 100644 index 0000000..0a382e3 --- /dev/null +++ b/.github/workflows/build-deploy-and-preview.yml @@ -0,0 +1,28 @@ +name: Build, Deploy to GitHub Pages and Deploy PR Preview + +on: + push: + branches: [main, master] + pull_request: + types: + - opened + - reopened + - synchronize + - closed + +permissions: + contents: write + pull-requests: write + +concurrency: ci-${{ github.ref }} + +jobs: + build-deploy-and-preview: + name: Build, Deploy to GitHub Pages and Deploy PR Preview + runs-on: ubuntu-latest + steps: + - name: Build, Deploy to GitHub Pages and Deploy PR Preview + uses: chvmvd/build-deploy-and-preview-action@v1.2.0 + with: + type: docusaurus + package-manager: yarn \ No newline at end of file diff --git a/docusaurus.config.js b/docusaurus.config.js index 7350b21..fd6265e 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -10,7 +10,8 @@ const config = { title: 'DevOpsDays Chicago Runbooks', tagline: 'Documentation for running the DevOpsDays Chicago event', url: 'https://docs.devopsdayschi.org', - baseUrl: '/', + // baseUrl: '/', + baseUrl: process.env.GITHUB_ACTIONS ? `${process.env.BASE_URL}/` : "/", onBrokenLinks: 'warn', onBrokenMarkdownLinks: 'warn', favicon: 'img/favicon.ico', From 84cc6821f1806318c1f2bc61fd0e09762c8df30d Mon Sep 17 00:00:00 2001 From: Matty Stratton Date: Mon, 4 Mar 2024 13:47:56 -0600 Subject: [PATCH 2/2] Update for base gh pages deployment Signed-off-by: Matty Stratton --- .../workflows/build-deploy-and-preview.yml | 28 ------------------- .github/workflows/deploy.yml | 0 .github/workflows/test-deploy.yml | 27 ++++++++++++++++++ docusaurus.config.js | 4 +-- 4 files changed, 29 insertions(+), 30 deletions(-) delete mode 100644 .github/workflows/build-deploy-and-preview.yml create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/test-deploy.yml diff --git a/.github/workflows/build-deploy-and-preview.yml b/.github/workflows/build-deploy-and-preview.yml deleted file mode 100644 index 0a382e3..0000000 --- a/.github/workflows/build-deploy-and-preview.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Build, Deploy to GitHub Pages and Deploy PR Preview - -on: - push: - branches: [main, master] - pull_request: - types: - - opened - - reopened - - synchronize - - closed - -permissions: - contents: write - pull-requests: write - -concurrency: ci-${{ github.ref }} - -jobs: - build-deploy-and-preview: - name: Build, Deploy to GitHub Pages and Deploy PR Preview - runs-on: ubuntu-latest - steps: - - name: Build, Deploy to GitHub Pages and Deploy PR Preview - uses: chvmvd/build-deploy-and-preview-action@v1.2.0 - with: - type: docusaurus - package-manager: yarn \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml new file mode 100644 index 0000000..04053e9 --- /dev/null +++ b/.github/workflows/test-deploy.yml @@ -0,0 +1,27 @@ +name: Test deployment + +on: + pull_request: + branches: + - main + # 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: + test-deploy: + name: Test deployment + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn + + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Test build website + run: yarn build + \ No newline at end of file diff --git a/docusaurus.config.js b/docusaurus.config.js index fd6265e..b50d9d4 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -10,8 +10,8 @@ const config = { title: 'DevOpsDays Chicago Runbooks', tagline: 'Documentation for running the DevOpsDays Chicago event', url: 'https://docs.devopsdayschi.org', - // baseUrl: '/', - baseUrl: process.env.GITHUB_ACTIONS ? `${process.env.BASE_URL}/` : "/", + baseUrl: '/', + trailingSlash: false, onBrokenLinks: 'warn', onBrokenMarkdownLinks: 'warn', favicon: 'img/favicon.ico',