Skip to content

Merge pull request #102 from automl/development #37

Merge pull request #102 from automl/development

Merge pull request #102 from automl/development #37

Workflow file for this run

name: docs
on:
# Manual trigger option in github
# This won't push to github pages where docs are hosted due
# to the gaurded if statement in those steps
workflow_dispatch:
# Trigger on push to these branches
push:
branches:
- main
# Trigger on a open/push to a PR targeting one of these branches
pull_request:
branches:
- main
env:
name: CARL
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
pip install ".[docs]"
- name: Make docs
run: |
make clean
make doc
- name: Pull latest gh_pages
if: (contains(github.ref, 'version_0.2.0') || contains(github.ref, 'main')) && github.event_name == 'push'
run: |
cd ..
git clone https://github.com/${{ github.repository }}.git --branch gh_pages --single-branch gh_pages
- name: Copy new docs into gh_pages
if: (contains(github.ref, 'version_0.2.0') || contains(github.ref, 'main')) && github.event_name == 'push'
run: |
branch_name=${GITHUB_REF##*/}
cd ../gh_pages
rm -rf $branch_name
cp -r ../${{ env.name }}/docs/build/html $branch_name
- name: Push to gh_pages
if: (contains(github.ref, 'version_0.2.0') || contains(github.ref, 'main')) && github.event_name == 'push'
run: |
last_commit=$(git log --pretty=format:"%an: %s")
cd ../gh_pages
branch_name=${GITHUB_REF##*/}
git add $branch_name/
git config --global user.name 'Github Actions'
git config --global user.email 'not@mail.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "$last_commit"
git push