diff --git a/.github/workflows/pull_request_docs_preview.yml b/.github/workflows/pull_request_docs_preview.yml index bedab44..7a89acf 100644 --- a/.github/workflows/pull_request_docs_preview.yml +++ b/.github/workflows/pull_request_docs_preview.yml @@ -1,4 +1,4 @@ -name: "🦕 Docusaurus Documentation Website (PR Preview)" +name: "🦕 Docusaurus Documentation Website (PR Preview)" on: pull_request: @@ -9,6 +9,9 @@ on: - reopened - synchronize - closed + paths: + - 'website/**' + - '.github/workflows/pull_request_docs_preview.yml' permissions: contents: write @@ -20,11 +23,12 @@ defaults: jobs: deploy-preview: + if: github.event.pull_request.head.ref != 'release-prep' runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6 - + - name: Setup Node.js uses: actions/setup-node@v6 with: @@ -34,29 +38,29 @@ jobs: - name: Install dependencies run: npm ci - + - name: Build website run: npm run build env: - DOCUSAURUS_BASE_URL: /pr-preview/pr-${{ github.event.pull_request.number }}/ + PR_NUMBER: ${{ github.event.pull_request.number }} - name: Deploy preview uses: rossjrw/pr-preview-action@v1 with: source-dir: ./website/build/ - + # - name: Comment PR # uses: actions/github-script@v7 # with: # script: | # const url = `https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/`; # const comment = `### 📖 Documentation Preview - + # The documentation preview for this PR is available at: # ${url} - + # This preview will be updated automatically when the PR is updated.`; - + # github.rest.issues.createComment({ # issue_number: context.issue.number, # owner: context.repo.owner, diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b938683..b7c8635 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,11 @@ name: Release on: workflow_dispatch: {} + push: + branches: + - main + paths: + - CHANGELOG.md permissions: contents: write diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 830d830..55a009c 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -8,6 +8,11 @@ import { themes as prismThemes } from "prism-react-renderer"; // This runs in Node.js - Don't use client-side code here (browser APIs, JSX...) +const BASE_URL = + process.env.PR_NUMBER !== undefined + ? `/busly-cli/pr-preview/pr-${process.env.PR_NUMBER}/` + : "/busly-cli"; + /** @type {import('@docusaurus/types').Config} */ const config = { title: "Busly CLI for NServiceBus", @@ -21,7 +26,7 @@ const config = { url: "https://tragiccode.com", // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' - baseUrl: "/busly-cli", + baseUrl: BASE_URL, // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these.