Skip to content

Commit

Permalink
Added deployment website preview
Browse files Browse the repository at this point in the history
  • Loading branch information
atteggiani committed Nov 7, 2023
1 parent 104e253 commit 884e976
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/create_pr_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- synchronize

concurrency:
group: preview-${{ github.ref }}
group: preview-${{ github.event.number }}
cancel-in-progress: true

env:
Expand All @@ -32,13 +32,13 @@ jobs:
run: pip install -r requirements.txt

- name: Build preview website
run: mkdocs build -f mkdocs.yml -d pr_preview
run: mkdocs build -f mkdocs.yml -d website

- name: Add preview on gh-pages branch
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: ${{ env.TARGET_BRANCH }}
folder: pr_preview
folder: website
target-folder: ${{ env.TARGET_FOLDER }}
commit-message: Deploy preview for PR ${{ env.PR }} 🛫
force: false
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/deploy_development_website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deploy development website

on:
push:
branches:
- development
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: deploy-development
cancel-in-progress: true

env:
TARGET_FOLDER: development_website
TARGET_BRANCH: gh-pages

jobs:
build-and-deploy-preview:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Python setup
uses: actions/setup-python@v4
with:
python-version: 3.x

- name: Install dependencies
run: pip install -r requirements.txt

- name: Build preview website
run: mkdocs build -f mkdocs.yml -d website

- name: Add preview on gh-pages branch
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: ${{ env.TARGET_BRANCH }}
folder: website
target-folder: ${{ env.TARGET_FOLDER }}
commit-message: Deploy development website. 🛫
force: false

# - name: Deploy to Github pages
11 changes: 8 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ permissions:
# 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"
group: publish-website
cancel-in-progress: false

env:
TARGET_BRANCH: gh-pages

jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }}
Expand All @@ -36,8 +39,10 @@ jobs:
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: website
branch: gh-pages # default
clean-exclude: pr-preview/ # don't overwrite previews
branch: ${{ env.TARGET_BRANCH }}
clean-exclude: |
pr-preview/
development_website/
# deploy:
# needs: build
Expand Down
10 changes: 0 additions & 10 deletions docs/js/miscellaneous.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ function sortTables() {
tables.forEach(table => new Tablesort(table));
}

/*
Remove 'edit' and 'view' icons from homepage
*/
function removeIconsFromHomepage() {
if (location.pathname.match('^(/|/development_site/|/pr-preview/pr-[0-9]*/)$')) {
let icons=document.querySelectorAll(".md-content__button.md-icon");
icons.forEach(icon=>icon.style.display="none");
}
}

/*
Adjust the scrolling so that the paragraph's titles is not
partially covered by the sticky banner when clicking on a toc link
Expand Down
2 changes: 0 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ theme:
- navigation.indexes
- navigation.footer
- navigation.tracking # The URL in the address bar is automatically updated with active anchor
- content.action.edit
- content.action.view
- content.code.copy # for displaying copy icon at top right in code snippets
- content.code.annotate
- content.tabs.link
Expand Down

0 comments on commit 884e976

Please sign in to comment.