From f2fbd5b02c314c888ef9f87ed6b4ea5a62a4cd01 Mon Sep 17 00:00:00 2001 From: Daniel Mantei <7349533+diversable@users.noreply.github.com> Date: Thu, 21 Dec 2023 22:11:24 -0800 Subject: [PATCH 1/7] Fix: Github Actions Deploy to gh pages; Create publish_mdbook.yml action --- .github/workflows/publish_mdbook.yml | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/publish_mdbook.yml diff --git a/.github/workflows/publish_mdbook.yml b/.github/workflows/publish_mdbook.yml new file mode 100644 index 0000000..fee4d1d --- /dev/null +++ b/.github/workflows/publish_mdbook.yml @@ -0,0 +1,66 @@ +# To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html +# +name: Deploy mdBook site to Github Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + env: + MDBOOK_VERSION: 0.4.36 + steps: + - uses: actions/checkout@v4 + - name: Install mdBook + run: | + curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh + rustup update + cargo install --version ${MDBOOK_VERSION} mdbook + + - name: Install mdbook-admonish + run: | + cargo install mdbook-admonish --vers "1.14.0" --locked + mdbook-admonish install ./ + + - name: Setup Pages + id: pages + uses: actions/configure-pages@v4 + + - name: Build with mdBook + run: mdbook build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: ./book + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v3 From a200104e770d176a2393c7d2194b1e1963d6164b Mon Sep 17 00:00:00 2001 From: Daniel Mantei <7349533+diversable@users.noreply.github.com> Date: Thu, 21 Dec 2023 22:23:29 -0800 Subject: [PATCH 2/7] Stop using `publish-book.yml` script --- .github/workflows/publish-book.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-book.yml b/.github/workflows/publish-book.yml index 377325a..e0d9aac 100644 --- a/.github/workflows/publish-book.yml +++ b/.github/workflows/publish-book.yml @@ -2,8 +2,8 @@ name: Deploy book on: push: paths: ["**"] - branches: - - main + # branches: + # - main jobs: deploy: From 4670a7d19c721a6caf970f49689cd2a20f3cfdaa Mon Sep 17 00:00:00 2001 From: Daniel Mantei <7349533+diversable@users.noreply.github.com> Date: Thu, 21 Dec 2023 22:25:40 -0800 Subject: [PATCH 3/7] test "publish_mdbook.yml" on fix branch --- .github/workflows/publish_mdbook.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_mdbook.yml b/.github/workflows/publish_mdbook.yml index fee4d1d..f2920d7 100644 --- a/.github/workflows/publish_mdbook.yml +++ b/.github/workflows/publish_mdbook.yml @@ -5,7 +5,7 @@ name: Deploy mdBook site to Github Pages on: # Runs on pushes targeting the default branch push: - branches: ["main"] + branches: ["main", "fix-gh-pages"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: From e58227cb75d4b6a8f50f0ae7528a95c422fed1b0 Mon Sep 17 00:00:00 2001 From: Diversable Date: Thu, 21 Dec 2023 22:39:50 -0800 Subject: [PATCH 4/7] test deployment --- .github/workflows/publish_mdbook.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish_mdbook.yml b/.github/workflows/publish_mdbook.yml index f2920d7..fcfd9d6 100644 --- a/.github/workflows/publish_mdbook.yml +++ b/.github/workflows/publish_mdbook.yml @@ -1,6 +1,6 @@ # To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html # -name: Deploy mdBook site to Github Pages +name: Deploy Leptos Book to Github Pages on: # Runs on pushes targeting the default branch @@ -40,14 +40,14 @@ jobs: run: | cargo install mdbook-admonish --vers "1.14.0" --locked mdbook-admonish install ./ - + - name: Setup Pages id: pages uses: actions/configure-pages@v4 - + - name: Build with mdBook run: mdbook build - + - name: Upload artifact uses: actions/upload-pages-artifact@v2 with: From 2ca795f688caf896bd61d18a482c8a7933652001 Mon Sep 17 00:00:00 2001 From: Diversable Date: Thu, 21 Dec 2023 22:42:16 -0800 Subject: [PATCH 5/7] remove old gh action --- .github/workflows/publish-book.yml | 40 ------------------------------ 1 file changed, 40 deletions(-) delete mode 100644 .github/workflows/publish-book.yml diff --git a/.github/workflows/publish-book.yml b/.github/workflows/publish-book.yml deleted file mode 100644 index e0d9aac..0000000 --- a/.github/workflows/publish-book.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Deploy book -on: - push: - paths: ["**"] - # branches: - # - main - -jobs: - deploy: - runs-on: ubuntu-latest - permissions: - contents: write # To push a branch - pull-requests: write # To create a PR from that branch - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Install mdbook - run: | - mkdir mdbook - curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.35/mdbook-v0.4.35-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook - echo `pwd`/mdbook >> $GITHUB_PATH - - name: Install mdbook-admonish - run: | - cargo install mdbook-admonish --vers "1.14.0" --locked - mdbook-admonish install ./ - - name: Deploy GitHub Pages - run: | - mdbook build - git worktree add gh-pages - git config user.name "Deploy book from CI" - git config user.email "" - cd gh-pages - # Delete the ref to avoid keeping history. - git update-ref -d refs/heads/gh-pages - rm -rf * - mv ../book/* . - git add . - git commit -m "Deploy book $GITHUB_SHA to gh-pages" - git push --force --set-upstream origin gh-pages From f6c29312cf6614f259679ff2220010564cee513a Mon Sep 17 00:00:00 2001 From: Diversable Date: Thu, 21 Dec 2023 22:48:31 -0800 Subject: [PATCH 6/7] simplify publish script --- .github/workflows/publish_mdbook.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish_mdbook.yml b/.github/workflows/publish_mdbook.yml index fcfd9d6..313c324 100644 --- a/.github/workflows/publish_mdbook.yml +++ b/.github/workflows/publish_mdbook.yml @@ -23,8 +23,14 @@ concurrency: cancel-in-progress: false jobs: + # Build job build: + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest env: MDBOOK_VERSION: 0.4.36 @@ -54,13 +60,13 @@ jobs: path: ./book # Deployment job - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: + # deploy: + # environment: + # name: github-pages + # url: ${{ steps.deployment.outputs.page_url }} + # runs-on: ubuntu-latest + # needs: build + # steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v3 From f1e30745eb47d17e713a9285d92b83d74b86d7b7 Mon Sep 17 00:00:00 2001 From: Diversable Date: Thu, 21 Dec 2023 23:18:56 -0800 Subject: [PATCH 7/7] Update deploy script --- .github/workflows/publish_mdbook.yml | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish_mdbook.yml b/.github/workflows/publish_mdbook.yml index 313c324..96f6483 100644 --- a/.github/workflows/publish_mdbook.yml +++ b/.github/workflows/publish_mdbook.yml @@ -1,11 +1,9 @@ -# To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html -# name: Deploy Leptos Book to Github Pages on: # Runs on pushes targeting the default branch push: - branches: ["main", "fix-gh-pages"] + branches: ["main"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -24,8 +22,8 @@ concurrency: jobs: - # Build job - build: + # Job: Build and Deploy to Pages + build-and-deploy: environment: name: github-pages @@ -59,14 +57,6 @@ jobs: with: path: ./book - # Deployment job - # deploy: - # environment: - # name: github-pages - # url: ${{ steps.deployment.outputs.page_url }} - # runs-on: ubuntu-latest - # needs: build - # steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v3