Skip to content

Commit

Permalink
add github action for docs building
Browse files Browse the repository at this point in the history
  • Loading branch information
weikang9009 committed Mar 3, 2023
1 parent b788ee7 commit d568598
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Building and hosting documentation for PACKAGE_NAME
#
# Notes:
# - After the first run of this workflow:
# - Within the project repo, navigate to Setting/Github Pages
# - set `the source pbranch to `gh-pages/(root))`.
# - Uncomment evertything below the following line to enable the workflow.
#---------------------------------------------------------------------------

name: Build Docs

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
inputs:
version:
description: Manual Doc Build
default: test
required: false
jobs:
docs:
name: build & push docs
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
matrix:
os: ['ubuntu-latest']
environment-file: [ci/311-BASE.yaml]
experimental: [false]
defaults:
run:
shell: bash -l {0}

steps:
- name: checkout repo
uses: actions/checkout@v3

- name: setup micromamba
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: ${{ matrix.environment-file }}
micromamba-version: 'latest'

- name: make docs
run: cd docs; make html

- name: commit docs
run: |
git clone https://github.com/ammaraskar/sphinx-action-test.git --branch gh-pages --single-branch gh-pages
cp -r docs/_build/html/* gh-pages/
cd gh-pages
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update documentation" -a || true
# The above command will fail if no changes were present,
# so we ignore the return code.
- name: push to gh-pages
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true

0 comments on commit d568598

Please sign in to comment.