Blog Release¶
This action is responsible for building and deploying the blog component of the arlunio website. Currently this is only composed of the gallery.
Triggers¶
This action is triggered whenever a commit has been made to the develop
branch within the blog/
directory so that new additions are published
immediately.
push:
branches:
- develop
paths:
- 'blog/**'
It is also configured to run everyday at 06:00
so that we can ensure the
gallery still builds and to keep it fresh. The fairly cryptic syntax can be
visualised by visting the crontab.guru site.
schedule:
- cron: '0 6 * * *'
Finally we also trigger this action on every PR that makes changes to the
blog/
directory to ensure any additions won’t break the build.
pull_request:
branches:
- develop
paths:
- 'blog/**'
Jobs¶
We only need to build the site once and deploy it so we only need to run it with a single instance.
Build:
runs-on: ubuntu-latest
Steps¶
Setup¶
We start off with the basics, checking out the repo, configuring the build
environment etc. Notice that we install the pre-release version of
arlunio
, this is so we can see if any changes are going to break any
uses cases currently covered by the gallery.
- uses: actions/checkout@v1
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Setup Environment
run: |
python --version
python -m pip install --upgrade pip
python -m pip install .
python -m pip install -r blog/requirements.txt
Build Blog¶
As mentioned above the only component currently in the blog is the gallery,
which we will build now. The details of this are handled by the
gallery.py
script that is not detailed here.
- name: Build Gallery
run: |
cd docs
# Extract examples from the docs as a notebook and copy into gallery
make nbgallery
ls -1 _build/nbgallery/examples/
cp _build/nbgallery/examples/*.ipynb ../blog/src/gallery
# Also make the source notebooks available for binder.
cd ../blog
mkdir public/examples
cp src/gallery/*.ipynb public/examples
# Build the gallery
python gallery.py
Delpoy Blog¶
Finally, if this is not a PR build, we publish the built site to our
gh-pages
branch using JamesIves/github-pages-deploy-action.
- name: Publish Release Artifact
uses: actions/upload-artifact@v1.0.0
with:
name: 'blog'
path: blog/public
if: github.event_name == 'pull_request'
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BASE_BRANCH: develop
BRANCH: gh-pages
FOLDER: blog/public
if: github.event_name != 'pull_request'