Merge pull request #216 from alan-turing-institute/update-python-requ… #150
This file contains 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: Build documentation | |
# Run workflow on pushes to matching branches | |
on: | |
push: | |
branches: [main] | |
# checkout needs 'contents:read' | |
# deploy needs 'contents:write' | |
permissions: | |
contents: write | |
jobs: | |
build_docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup SSH keys | |
if: ${{ !env.ACT }} | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Install apt packages | |
run: sudo apt-get update && sudo apt-get -y install ffmpeg texlive-latex-base texlive-latex-extra | |
- name: Install Python packages | |
run: pip install -r requirements.txt | |
- name: Configure git user | |
shell: bash | |
run: | | |
git config --global user.name "Turing Developer" | |
git config --global user.email "[email protected]" | |
git config --global pull.rebase false | |
# Remove git http extraheader arguments as these conflict with the use of SSH keys | |
- name: Remove git http extraheader arguments | |
if: ${{ !env.ACT }} | |
shell: bash | |
run: | | |
git config --list | grep "^http.*extraheader" | cut -d '=' -f 1 | xargs -L1 git config --unset-all | |
git --no-pager config --list | |
- name: Build latest documentation | |
shell: bash | |
run: ./build_docs.sh | |
- name: Deploy documentation to GitHub Pages | |
if: ${{ !env.ACT }} | |
uses: JamesIves/github-pages-deploy-action@5dc1d5a192aeb5ab5b7d5a77b7d36aea4a7f5c92 # This is version 4.1.4 | |
with: | |
branch: gh-pages # The branch the action should deploy to. | |
folder: _build # The folder the action should deploy. | |
git-config-name: Deployment Bot # Name of the committer | |
git-config-email: [email protected] # Email of the committer |