Models page fixes, link fixes and Research Lab updates with the new v… #313
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- master | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
key: mkdocs-material-${{ env.cache_id }} | |
path: .cache | |
restore-keys: | | |
mkdocs-material- | |
- name: Install dependencies | |
run: | | |
pip install mkdocs-material | |
pip install mkdocs-redirects | |
pip install beautifulsoup4 | |
pip install lxml | |
- name: Get mkdocs-material version | |
run: | | |
MKDOCS_MATERIAL_VERSION=$(pip show mkdocs-material | grep Version | cut -d ' ' -f 2) | |
echo "MKDOCS_MATERIAL_VERSION=$MKDOCS_MATERIAL_VERSION" >> $GITHUB_ENV | |
- name: Build the MkDocs site | |
run: | | |
mkdocs build | |
# Custom step to modify HTML files | |
- name: Duplicate the generated site dir with postprocessing (non-blocking) | |
run: | | |
if python ./scripts/duplicate_site_with_postprocess.py ./site ../site_postprocessed; then | |
echo "Post-processing OK" | |
else | |
echo "Post-processing failed, using unprocessed site" | |
rm -rf ../site_postprocessed | |
cp -r ./site ../site_postprocessed | |
fi | |
- name: Deploy to GitHub Pages | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
git fetch origin gh-pages | |
git checkout gh-pages || git checkout --orphan gh-pages | |
ls -lh | |
git status | |
cp -r ../site_postprocessed/* . | |
git add . | |
git commit -m "Deployed ${GITHUB_SHA} with mkdocs-material v${{ env.MKDOCS_MATERIAL_VERSION }} and HTML post-processing" | |
git push origin gh-pages --force |