fix: Re-use poetry cache from CI step for publish docs (#189) #63
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
#################################################################################################### | |
# Continuous Deployment [API Docs Website] on Push to Master | |
#################################################################################################### | |
# References: | |
# - https://github.com/SamKirkland/FTP-Deploy-Action | |
#################################################################################################### | |
name: docs | |
on: | |
push: | |
branches: ["master"] | |
jobs: | |
ci: | |
#---------------------------------------------- | |
# ----- setup operating system (os) ----- | |
#---------------------------------------------- | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest"] | |
python-version: ["3.9"] | |
steps: | |
#---------------------------------------------- | |
# ----- check-out repo and set-up python ----- | |
#---------------------------------------------- | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup Python v${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
#---------------------------------------------- | |
# ----- install & configure poetry ----- | |
#---------------------------------------------- | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
#---------------------------------------------- | |
# ----- load cached dependencies ----- | |
#---------------------------------------------- | |
- name: Load Cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
#---------------------------------------------- | |
# ----- install dependencies ----- | |
#---------------------------------------------- | |
- name: Install Dependencies | |
run: poetry install -vv | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
#---------------------------------------------- | |
# ----- Create API docs via Sphinx ----- | |
#---------------------------------------------- | |
- name: Docs | |
run: | | |
source $VENV | |
poe greet | |
poe sphinx | |
#---------------------------------------------- | |
# --- Deploy docs to docs.slickml.com --- | |
#---------------------------------------------- | |
- name: Deploy API Docs | |
uses: SamKirkland/[email protected] | |
with: | |
server: ${{ secrets.FTP_SERVER }} | |
username: ${{ secrets.FTP_USERNAME }} | |
password: ${{ secrets.FTP_PASSWORD }} | |
local-dir: ./docs/_build/ |