Add binning capability to AUPRO (#1145) #18
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
name: Docs | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- ".github/**" # Ignore changes towards the .github directory | |
workflow_dispatch: # run on request (no need for PR) | |
permissions: | |
contents: write | |
jobs: | |
Build-and-Publish-Documentation: | |
runs-on: [docs] | |
steps: | |
- name: CHECKOUT REPOSITORY | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install requirements | |
run: | | |
pip install -r requirements/docs.txt | |
pip install .[full] | |
- name: Link dataset path to local directory as nbsphinx runs the notebook | |
run: ln -s $ANOMALIB_DATASET_PATH ./datasets | |
- name: Build and Commit Docs | |
run: | | |
cd docs | |
make html | |
- name: Create gh-pages branch | |
run: | | |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} | |
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} | |
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} | |
existed_in_remote=$(git ls-remote --heads origin gh-pages) | |
if [[ -z ${existed_in_remote} ]]; then | |
echo "Creating gh-pages branch" | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git checkout --orphan gh-pages | |
git reset --hard | |
touch .nojekyll | |
git add .nojekyll | |
git commit -m "Initializing gh-pages branch" | |
git push origin gh-pages | |
git checkout ${{steps.branch_name.outputs.SOURCE_NAME}} | |
echo "Created gh-pages branch" | |
else | |
echo "Branch gh-pages already exists" | |
fi | |
- name: Commit docs to gh-pages branch | |
run: | | |
git fetch | |
git checkout gh-pages | |
mkdir -p /tmp/docs_build | |
cp -r docs/build/html/* /tmp/docs_build/ | |
rm -rf ./* | |
cp -r /tmp/docs_build/* ./ | |
rm -rf /tmp/docs_build | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Update documentation" -a || true | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages |