Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,20 @@ jobs:
uses: ./.github/actions/execute-notebooks

- name: Make BASE_URL
run: echo ${{ github.ref }} | sed "s/[^0-9]//g" | (v=$(cat); echo -e "BASE_URL=/pr-preview/pr-$v/" ) >> $GITHUB_ENV
uses: actions/github-script@v6
id: base-url
with:
script: |
const refName = "${{ github.ref_name }}"; // PR_NUMBER/merge
const prNumber = refName.slice(0, refName.length - 6);
const baseUrl = `/pr-preview/pr-${prNumber}/`;
return baseUrl;
result-encoding: string

- name: Build
uses: ./.github/actions/build
with:
base-url: $BASE_URL
base-url: ${{ steps.base-url.outputs.result }}

- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
Expand Down
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const config = {
title: "Introduction to Algorithms",
// tagline: '',
url: "https://sikepuri-algorithm.github.io",
baseUrl: process.env.NODE_ENV ? "/" : process.env.BASE_URL,
baseUrl: process.env.NODE_ENV === "development" ? "/" : process.env.BASE_URL,
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.ico",
Expand Down