diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2b89e25..1f16b16 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile - name: Build website - run: yarn build + run: BASEURL='/' yarn build - name: Upload Build Artifact uses: actions/upload-pages-artifact@v3 @@ -49,4 +49,10 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: JamesIves/github-pages-deploy-action@v4 + with: + clean-exclude: pr-preview/ + with: + folder: build + with: + force: false diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml new file mode 100644 index 0000000..1300966 --- /dev/null +++ b/.github/workflows/pr-preview.yml @@ -0,0 +1,43 @@ +# .github/workflows/preview.yml +name: Deploy PR previews + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - closed + label: + types: + - preview + +concurrency: preview-${{ github.ref }} + +jobs: + deploy-preview: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn + - name: Get submodules + run: git submodule init && git submodule update --remote --merge + - name: Install and Build + if: github.event.action != 'closed' # You might want to skip the build if the PR has been closed + env: + pr: ${{ github.event.number }} + run: | + echo "pr=$pr" >> $GITHUB_ENV + yarn install --frozen-lockfile + BASEURL='/pr-preview/pr-$pr' yarn build + + - name: Deploy preview + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: ./build/ \ No newline at end of file diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml deleted file mode 100644 index 46cabc3..0000000 --- a/.github/workflows/test-deploy.yml +++ /dev/null @@ -1,27 +0,0 @@ -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: Get submodules - run: git submodule init && git submodule update --remote --merge - - name: Install dependencies - run: yarn install --frozen-lockfile - - name: Test build website - run: yarn build diff --git a/docusaurus.config.js b/docusaurus.config.js index 9631f72..756a6da 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -17,7 +17,7 @@ const config = { url: 'https://keychain.org', // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' - baseUrl: '/', + baseUrl: process.env.BASEURL, // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. diff --git a/kc b/kc index 4733361..0e646d5 160000 --- a/kc +++ b/kc @@ -1 +1 @@ -Subproject commit 473336106118b08b1468be77e01b88ad55314024 +Subproject commit 0e646d5cd3413502f43f9a46fbfb17046cd0b999