Automatic docs deployment to GitHub Pages (#91) #1
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: docs | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
concurrency: | |
group: 'github-pages' | |
cancel-in-progress: true | |
env: | |
NUMBA_NUM_THREADS: 1 | |
MPLBACKEND: Agg | |
jobs: | |
docs: | |
runs-on: [self-hosted, x64, Linux, ubuntu, generic] | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10.9" | |
- name: Update pip | |
run: | | |
python -m pip install --upgrade pip | |
- name: Install required packages | |
run: | | |
sudo apt-get -y install pandoc make | |
- name: Install doc dependencies | |
run: | | |
pip install -e .[doc] | |
python -c 'import iop4lib; print(iop4lib.__version__)' | |
- name: Download test data | |
env: | |
TEST_DATA_PASSWORD: ${{ secrets.test_data_password }} | |
run: | | |
export TESTDATA_MD5SUM=`grep 'TESTDATA_MD5SUM' ./tests/conftest.py | awk -F"'" '{print $2}' | tr -d '\n'` | |
wget --post-data "pass=$TEST_DATA_PASSWORD" "https://vhega.iaa.es/iop4/iop4testdata.tar.gz?md5sum=$TESTDATA_MD5SUM" -O $HOME/iop4testdata.tar.gz | |
- name: Extract test data in the default data folder | |
run: | | |
tar -xzf $HOME/iop4testdata.tar.gz -C $HOME | |
mv $HOME/iop4testdata $HOME/.iop4data | |
- name: Create the DB | |
run: | | |
cd iop4site | |
python manage.py makemigrations | |
python manage.py makemigrations iop4api | |
python manage.py migrate --no-input | |
ls -lh $HOME/.iop4data/ | |
- name: Build docs | |
run: make docs-sphinx | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
name: github-pages | |
path: docs/_build/html | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |