Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
bparks13 committed Apr 10, 2024
1 parent 37bfc88 commit 13a1b31
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 54 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Test Documentation

on:
pull_request:
branches:
- main

jobs:
build_and_test:
name: Build and Test
runs-on: ubuntu-22.04
environment: Testing

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10.12"

- name: Install pipenv and dependencies
run: |
python -m pip install --upgrade pipenv wheel
pipenv install --deploy --dev
- name: Build HTML pages
id: make_html
run: |
pipenv run make html SPHINXOPTS="-W --keep-going" # -W: Fail on warnings. --keep-going: Continue processing on warnings, but fail at the end
- name: Check all external links
id: make_linkcheck
run: |
pipenv run make linkcheck SPHINXOPTS="-W --keep-going -n" # -n: nit-picky mode, generates warnings for all missing references
- name: Upload docs
uses: actions/upload-artifact@v4
with:
name: html
if-no-files-found: error
path: docs/html/*
44 changes: 44 additions & 0 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy Documentation

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-22.04
environment: Production

steps:
- name: Download html artifact
run: |
repo="${{ github.repository }}"
workflow="build_and_test.yml"
artifact="html"
run_id=`gh run --repo ${repo} list --workflow ${workflow} --json databaseId --jq .[0].databaseId`
mkdir html
cd html
gh run --repo ${repo} download ${run_id} -n ${artifact}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Commit documentation changes
run: |
git clone https://github.com/${{ github.repository_owner }}/miniscope-docs.git --branch gh-pages --single-branch gh-pages
cd gh-pages
rm -rf *
cp -r ../html/* .
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update documentation" -a || true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
54 changes: 0 additions & 54 deletions .github/workflows/gh-pages.yml

This file was deleted.

0 comments on commit 13a1b31

Please sign in to comment.