From 1dfff04af181f7090e3e1b7057bb5e8ec6834a91 Mon Sep 17 00:00:00 2001 From: Matty Stratton Date: Mon, 4 Mar 2024 14:09:47 -0600 Subject: [PATCH 1/4] update deploy preview Signed-off-by: Matty Stratton --- .github/workflows/deploy.yml | 12 ++++++------ .github/workflows/test-deploy.yml | 27 ++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e09f1a6..6c61c17 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -31,16 +31,16 @@ jobs: # Popular action to deploy to GitHub Pages: # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + uses: JamesIves/github-pages-deploy-action@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + # token: ${{ secrets.GITHUB_TOKEN }} # Build output to publish to the `gh-pages` branch: - publish_dir: ./build + folder: ./build # The following lines assign commit authorship to the official # GH-Actions bot for deploys to `gh-pages` branch: # https://github.com/actions/checkout/issues/13#issuecomment-724415212 # The GH actions bot is used by default if you didn't specify the two fields. # You can swap them out with your own user credentials. - user_name: github-actions[bot] - user_email: 41898282+github-actions[bot]@users.noreply.github.com - \ No newline at end of file + git-config-name: github-actions[bot] + git-config-email: 41898282+github-actions[bot]@users.noreply.github.com + clean-exclude: pr-preview/ diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 04053e9..543d6cb 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -4,6 +4,12 @@ on: pull_request: branches: - main + types: + - opened + - reopened + - synchronize + - closed +concurrency: preview-${{ github.ref }} # 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 @@ -24,4 +30,23 @@ jobs: run: yarn install --frozen-lockfile - name: Test build website run: yarn build - \ No newline at end of file + deploy-preview: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn + - name: Install and Build + if: github.event.action != 'closed' # You might want to skip the build if the PR has been closed + run: | + yarn install --frozen-lockfile + run: yarn build + + - name: Deploy preview + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: ./build/ From 90f7359be3f855eafe5132b83d75136d3a72b1dc Mon Sep 17 00:00:00 2001 From: Matty Stratton Date: Mon, 4 Mar 2024 14:13:20 -0600 Subject: [PATCH 2/4] fix workflow file Signed-off-by: Matty Stratton --- .github/workflows/test-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 543d6cb..dc4a0b4 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -44,7 +44,7 @@ jobs: if: github.event.action != 'closed' # You might want to skip the build if the PR has been closed run: | yarn install --frozen-lockfile - run: yarn build + yarn build - name: Deploy preview uses: rossjrw/pr-preview-action@v1 From 2e0f3633dccd3dc07a45f8cd9af6c4d1e132e80f Mon Sep 17 00:00:00 2001 From: Matty Stratton Date: Mon, 4 Mar 2024 17:11:43 -0600 Subject: [PATCH 3/4] fix baseurl Signed-off-by: Matty Stratton --- docusaurus.config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index b50d9d4..4fb7264 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -4,13 +4,17 @@ const {themes} = require('prism-react-renderer'); const lightCodeTheme = themes.github; const darkCodeTheme = themes.dracula; +const base = '/docusaurus-pr-preview-gh' +const baseUrl = (process.env.PREVIEW_PATH) + ? `${base}/${process.env.PREVIEW_PATH}` + : `${base}` /** @type {import('@docusaurus/types').Config} */ const config = { title: 'DevOpsDays Chicago Runbooks', tagline: 'Documentation for running the DevOpsDays Chicago event', url: 'https://docs.devopsdayschi.org', - baseUrl: '/', + baseUrl: 'baseurl', trailingSlash: false, onBrokenLinks: 'warn', onBrokenMarkdownLinks: 'warn', From 4399414922cc10c80e972929aca5ceff422f3725 Mon Sep 17 00:00:00 2001 From: Matty Stratton Date: Mon, 4 Mar 2024 17:23:17 -0600 Subject: [PATCH 4/4] Fix deploy again Signed-off-by: Matty Stratton --- .github/workflows/test-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index dc4a0b4..93e2042 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + - run: echo "PREVIEW_PATH=pr-preview/pr-${{ github.event.number }}" >> "$GITHUB_ENV" - uses: actions/setup-node@v4 with: node-version: 18