Skip to content

Commit e5c82a3

Browse files
authored
Improve Deployments of Docusaurus Site & Papers (#7347)
1 parent b2a5de1 commit e5c82a3

File tree

4 files changed

+39
-6
lines changed

4 files changed

+39
-6
lines changed

.github/workflows/docusaurus-site.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow builds and deploys the Docusaurus site.
22
#
33
# On pull requests, this workflow builds the site and deploys a temporary preview
4-
# to gh-pages.
4+
# to gh-pages, but only if the relevant files have changed.
55
#
66
# On push to master or on workflow dispatch it deploys the site to:
77
# https://plutus.cardano.intersectmbo.org/docs
@@ -15,6 +15,9 @@ on:
1515
- master
1616
workflow_dispatch:
1717
pull_request:
18+
paths:
19+
- 'doc/docusaurus/**'
20+
- '.github/workflows/docusaurus-site.yml'
1821

1922
jobs:
2023
run:
@@ -49,14 +52,15 @@ jobs:
4952
PR_NUMBER="${{ github.event.pull_request.number }}"
5053
# These match the URL expected by rossjrw/[email protected]:
5154
export DOCUSAURUS_URL="https://plutus.cardano.intersectmbo.org"
52-
export DOCUSAURUS_BASE_URL="/pr-preview/pr-${PR_NUMBER}"
55+
export DOCUSAURUS_BASE_URL="/pr-preview/docs/pr-${PR_NUMBER}"
5356
nix develop --no-warn-dirty --accept-flake-config --command bash -c 'yarn && yarn build'
5457
5558
- name: Deploy Preview Site
56-
if: github.event_name == 'pull_request' && github.event.action != 'closed'
59+
if: github.event_name == 'pull_request'
5760
uses: rossjrw/[email protected]
5861
with:
5962
source-dir: doc/docusaurus/build
63+
umbrella-dir: pr-preview/docs
6064

6165

6266

.github/workflows/haddock-site.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ jobs:
7474

7575
- name: Delete Oldest Build
7676
run: |
77-
# Delete the oldest haddock build if there are more than 11 builds.
78-
if [[ $(ls -1A haddock | wc -l) -gt 11 ]]; then
77+
# Delete the oldest haddock build if there are more than 10 builds.
78+
if [[ $(ls -1A haddock | wc -l) -gt 10 ]]; then
7979
OLDEST_BUILD=$(ls -1A haddock | sort | head -n 1)
8080
rm -rf haddock/$OLDEST_BUILD
8181

.github/workflows/metatheory-site.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ jobs:
5757
with:
5858
ref: ${{ inputs.ref || github.ref_name }}
5959

60+
- name: Delete Oldest Build
61+
run: |
62+
# Delete the oldest metatheory build if there are more than 10 builds.
63+
if [[ $(ls -1A metatheory | wc -l) -gt 10 ]]; then
64+
OLDEST_BUILD=$(ls -1A metatheory | sort | head -n 1)
65+
rm -rf metatheory/$OLDEST_BUILD
66+
67+
git config user.name "github-actions[bot]"
68+
git config user.email "github-actions[bot]@users.noreply.github.com"
69+
git rm -r --cached metatheory/$OLDEST_BUILD || true
70+
git commit -am "Delete oldest metatheory build $OLDEST_BUILD"
71+
git push origin gh-pages
72+
fi
73+
6074
- name: Build Site
6175
run: |
6276
nix build --accept-flake-config .#metatheory-site

.github/workflows/papers-and-specs.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# This workflow builds and deploys various papers.
22
#
3+
# On pull requests, this workflow builds the papers and deploys a temporary preview
4+
# to gh-pages, but only if the relevant files have changed.
5+
#
36
# This workflow runs on all push to master and can also be triggered manually.
47
# It deploys the artifacts to: https://plutus.cardano.intersectmbo.org/resources
58

@@ -10,6 +13,10 @@ on:
1013
push:
1114
branches:
1215
- master
16+
pull_request:
17+
paths:
18+
- 'doc'
19+
- '!doc/docusaurus/**'
1320

1421
jobs:
1522
deploy:
@@ -42,8 +49,16 @@ jobs:
4249
done
4350
4451
- name: Publish Papers
52+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
4553
uses: JamesIves/[email protected]
4654
with:
4755
folder: _resources
4856
target-folder: resources
49-
single-commit: true
57+
single-commit: true
58+
59+
- name: Publish Preview Papers
60+
if: github.event_name == 'pull_request'
61+
uses: rossjrw/[email protected]
62+
with:
63+
source-dir: _resources
64+
umbrella-dir: pr-preview/resources

0 commit comments

Comments
 (0)