Skip to content

Commit

Permalink
Merge pull request #12 from DevOpsDaysChicago/mattstratton/use-gh-pages
Browse files Browse the repository at this point in the history
update deploy preview
  • Loading branch information
mattstratton authored Mar 4, 2024
2 parents a3ca8ef + 4399414 commit 2f64b4f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

git-config-name: github-actions[bot]
git-config-email: 41898282+github-actions[bot]@users.noreply.github.com
clean-exclude: pr-preview/
28 changes: 27 additions & 1 deletion .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -15,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
Expand All @@ -24,4 +31,23 @@ jobs:
run: yarn install --frozen-lockfile
- name: Test build website
run: yarn build

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
yarn build
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./build/
6 changes: 5 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 2f64b4f

Please sign in to comment.