Skip to content

Commit

Permalink
Merge pull request #223 from BradyAJohnston/docs-netlify
Browse files Browse the repository at this point in the history
Automatic  docs building, branch PR previes
  • Loading branch information
BradyAJohnston committed May 16, 2023
2 parents bf57ba0 + bc0a5e0 commit b86c9b4
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 542 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Documentation

on:
workflow_dispatch:
push:
branches: ["main", "docs-*"]

jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install quartodoc
- uses: quarto-dev/quarto-actions/setup@v2
with:
version: "1.2.475"
- name: Build docs
run: |
make docs-build
# push to netlify -------------------------------------------------------

# set release name ----

- name: Configure pull release name
if: ${{github.event_name == 'pull_request'}}
run: |
echo "RELEASE_NAME=pr-${PR_NUMBER}" >> $GITHUB_ENV
env:
PR_NUMBER: ${{ github.event.number }}
- name: Configure branch release name
if: ${{github.event_name != 'pull_request'}}
run: |
# use branch name, but replace slashes. E.g. feat/a -> feat-a
echo "RELEASE_NAME=${GITHUB_REF_NAME/\//-}" >> $GITHUB_ENV
# deploy ----

- name: Create Github Deployment
uses: bobheadxi/deployments@v0.4.3
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: ${{ env.RELEASE_NAME }}
ref: ${{ github.head_ref }}
transient: true
logs: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'

- name: Netlify docs preview
run: |
npm install -g netlify-cli
# push main branch to production, others to preview --
if [ "${ALIAS}" == "main" ]; then
netlify deploy --dir=docs/_build --alias="main"
else
netlify deploy --dir=docs/_build --alias="${ALIAS}"
fi
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
ALIAS: ${{ steps.deployment.outputs.env }}

- name: Update Github Deployment
uses: bobheadxi/deployments@v0.4.3
if: ${{ always() }}
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: 'https://${{ steps.deployment.outputs.env }}--molecularnodes.netlify.app'
logs: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
- uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'release'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docs-build:
cd docs && quartodoc build
quarto render docs
2 changes: 1 addition & 1 deletion docs/_quarto.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project:
type: website
output-dir: .
output-dir: _build

website:
title: "Molecular Nodes"
Expand Down
30 changes: 0 additions & 30 deletions docs/reference/coll.qmd

This file was deleted.

12 changes: 0 additions & 12 deletions docs/reference/index.qmd

This file was deleted.

115 changes: 0 additions & 115 deletions docs/reference/load.qmd

This file was deleted.

105 changes: 0 additions & 105 deletions docs/reference/nodes.qmd

This file was deleted.

Loading

0 comments on commit b86c9b4

Please sign in to comment.