Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🩹 Fix docs build #1307

Merged
merged 7 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 31 additions & 36 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,61 @@ on:
workflow_dispatch: # run on request (no need for PR)

permissions:
contents: write
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
Build-and-Publish-Documentation:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: [docs]
steps:
- name: CHECKOUT REPOSITORY
uses: actions/checkout@v2
uses: actions/checkout@v3

- 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]
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/}
cd ..

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 "[email protected]"
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
- name: Clean directory
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 "[email protected]"
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
touch .nojekyll

- name: Setup Pages
uses: actions/configure-pages@v2

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
# Upload entire repository
path: "."

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ dataset:
normalization: imagenet # data distribution to which the images will be normalized: [none, imagenet]
test_split_mode: from_dir # options: [from_dir, synthetic]
val_split_mode: same_as_test # options: [same_as_test, from_test, sythetic]
val_split_ratio: 0.5 # fraction of train/test images held out for validation (usage depends on val_split_mode)
val_split_ratio: 0.5 # fraction of train/test images held out for validation (usage depends on val_split_mode)
transform_config:
train: null
val: null
Expand Down