Skip to content

OpenWorm_docs History update #5758

OpenWorm_docs History update

OpenWorm_docs History update #5758

Workflow file for this run

name: Make Documentation
on:
push:
branches: [ master, development ]
pull_request:
branches: [ master, development ]
env:
REPO_METADATA_SHAS: repo-metadata-shas.txt
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: apt install
uses: nick-invision/[email protected]
with:
max_attempts: 5
timeout_minutes: 15
command: |
sudo apt-get update
sudo apt-get install -yqq build-essential libxml2-dev zlib1g-dev bison flex
- name: Set up Python install env
run: |
python3 -m venv venv
. venv/bin/activate
python -m pip install -U pip
echo "export MAKEFLAGS=\"PYTHON=$(which python) PIP_OPTS=-U\"" >> ~/.bashrc
- name: Install Python dependencies
uses: nick-invision/[email protected]
with:
max_attempts: 5
timeout_minutes: 15
command: |
. venv/bin/activate
pip install pygithub
make install
- name: Check and build
uses: nick-invision/[email protected]
with:
max_attempts: 5
timeout_minutes: 15
command: |
. venv/bin/activate
make check
export GITHUB_TOKEN=${{ github.token }}
make build
- name: Archive production artifacts
if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v2
with:
name: built-site
path: site
- name: mkdocs gh-deploy
if: github.ref == 'refs/heads/master'
run: |
SHA="${{ github.sha }}"
set -x
git fetch origin gh-pages:gh-pages
git config user.name github-actions
git config user.email [email protected]
. venv/bin/activate
mv $REPO_METADATA_SHAS $REPO_METADATA_SHAS.temp
git checkout gh-pages
cp $REPO_METADATA_SHAS.temp $REPO_METADATA_SHAS
LAST_BUILT_SHA=
if [[ -f ./last_build_sha ]] ; then
LAST_BUILT_SHA=$(cat last_build_sha)
fi
if [[ "$LAST_BUILT_SHA" = "$SHA" ]] && git diff origin/gh-pages --exit-code $REPO_METADATA_SHAS ; then
echo "No changes in repo metadata. Skipping deploy"
else
git checkout -
ghp-import -o -n site
git checkout gh-pages
echo -n $SHA > last_build_sha
git add last_build_sha
mv $REPO_METADATA_SHAS.temp $REPO_METADATA_SHAS
git commit --amend -m "Deploy master@$SHA [ci skip]"
git remote set-url origin https://${{ github.token }}@github.com/${{ github.repository_owner }}/openworm_docs.git
git push -f origin gh-pages
fi