From 5632e4a60cce0c3f7c83575b22584a84cd69b752 Mon Sep 17 00:00:00 2001 From: Daniel Cason Date: Fri, 29 Sep 2023 10:08:00 +0200 Subject: [PATCH 1/3] Symlink on built website to support `/docs/` links --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index b6439af..1ee1bf5 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,12 @@ build: @rm -rf _site @docker run -it --rm --volume ${PWD}:/srv/jekyll jekyll/builder:stable \ /bin/bash -c 'cd /srv/jekyll/ && bundle install && bundle exec jekyll build --future -V ' + @while read -r branch output_path visible ; do \ + ln -s . _site/$${output_path}/docs ; \ + done < VERSIONS + @if [ "${LOCAL_DOCS_REPO}" ]; then \ + ln -s . _site/dev/docs ; \ + fi @rm -rf _site/build .PHONY: build From 935ab9cdb5ec27c946fe8e5d7d8675f0701d3942 Mon Sep 17 00:00:00 2001 From: Daniel Cason Date: Fri, 29 Sep 2023 10:21:29 +0200 Subject: [PATCH 2/3] Added workflow version targetting this branch --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 776cdbd..eb3cb18 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ name: Build and Deploy to Netlify on: push: branches: - - main + - cason/docs-symlink workflow_dispatch: schedule: - cron: "0 0 * * *" From 94b34dad68eefdecb513f274f7d3229205ef3f90 Mon Sep 17 00:00:00 2001 From: Daniel Cason Date: Fri, 29 Sep 2023 11:03:36 +0200 Subject: [PATCH 3/3] Updating workflow using symlinks command --- .github/workflows/build.yml | 3 +++ Makefile | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eb3cb18..eea3e53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,6 +36,9 @@ jobs: run: | chmod a+wx . bundle exec jekyll build --disable-disk-cache -V + # Create _pages/version/docs link + - name: Add symbolic links + run: make symlinks # Deploy the _site folder to Netlify CometBFT documentation website - name: Deploy to Netlify uses: nwtgck/actions-netlify@v2.0.0 diff --git a/Makefile b/Makefile index 1ee1bf5..717d833 100644 --- a/Makefile +++ b/Makefile @@ -44,14 +44,17 @@ build: @rm -rf _site @docker run -it --rm --volume ${PWD}:/srv/jekyll jekyll/builder:stable \ /bin/bash -c 'cd /srv/jekyll/ && bundle install && bundle exec jekyll build --future -V ' + @rm -rf _site/build +.PHONY: build + +symlinks: + @if [ ! -d "_pages" ]; then echo "Directory _pages does not exist. Please run \"make fetch\" before running this command"; exit 1; fi @while read -r branch output_path visible ; do \ - ln -s . _site/$${output_path}/docs ; \ + [ -L _site/$${output_path}/docs ] || ln -vs . _site/$${output_path}/docs ; \ done < VERSIONS @if [ "${LOCAL_DOCS_REPO}" ]; then \ - ln -s . _site/dev/docs ; \ + [ -L_site/dev/docs ] || ln -vs . _site/dev/docs ; \ fi - @rm -rf _site/build -.PHONY: build # Creates _data/versions.yml, which is built from the VERSIONS file, in order # to provide information about versions to Jekyll during the site build