Unverified Commit 10591399 authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Build the doc in a seperate folder then move it (#16020)

* Build the doc in a seperate folder then move it

* Allow job

* Is this it?

* Dislike comments?

* Copy instead of move

* Removing version built

* Typos

* No variable

* Take _versions.yml into account

* Finish main job and add dev job

* Forgot the run

* Fix syntax error

* Execute builder from the repo

* Typo
parent 2f463eff
......@@ -96,19 +96,18 @@ jobs:
env:
NODE_OPTIONS: --max-old-space-size=6656
run: |
cd doc-build-dev && git pull
cd ../doc-builder
doc-builder build transformers ../transformers/docs/source --build_dir ../doc-build-dev --notebook_dir ../notebooks/transformers_doc --clean --version pr_$PR_NUMBER --html
doc-builder build transformers transformers/docs/source --build_dir build_dir --clean --version pr_$PR_NUMBER --html
- name: Push to repositories
run: |
cd doc-build-dev
ls
git pull
rm -rf transformers/pr_$PR_NUMBER
mv ../build_dir/transformers/pr_$PR_NUMBER transformers/pr_$PR_NUMBER
git status
if [[ `git status --porcelain` ]]; then
git add .
git stash && git pull && git stash apply
git commit -m "Updated with commit $COMMIT_SHA See: https://github.com/huggingface/transformers/commit/$COMMIT_SHA"
git push origin main
else
......
......@@ -4,6 +4,7 @@ on:
push:
branches:
- master
- doc_builder*
- doc-builder*
- v*-release
......@@ -75,42 +76,54 @@ jobs:
run: |
git config --global user.name "Hugging Face Doc Builder"
git config --global user.email docs@huggingface.co
- name: Create build directory
run: |
cd doc-build
git pull origin main
cd ..
cd notebooks
git pull origin master
git pull
cd ..
mkdir build_dir
mkdir build_dir/transformers
cp doc-build/transformers/_versions.yml build_dir/transformers
- name: Make documentation
run: |
cd doc-builder &&
doc-builder build transformers ../transformers/docs/source --build_dir ../doc-build --notebook_dir notebooks/transformers_doc --clean --html &&
doc-builder build transformers ../transformers/docs/source --build_dir ../build_dir --notebook_dir ../notebooks_dir --clean --html &&
cd ..
env:
NODE_OPTIONS: --max-old-space-size=6656
- name: Push to repositories
run: |
cd doc-build &&
cd doc-build
git pull
mv ../build_dir/transformers/_versions.yml transformers/
rm -rf transformers/$(ls ../build_dir/transformers)
mv ../build_dir/transformers/$(ls ../build_dir/transformers) transformers/$(ls ../build_dir/transformers)
git status
if [[ `git status --porcelain` ]]; then
git add . &&
git stash && git pull && git stash apply &&
git commit -m "Updated with commit ${{ github.sha }} \n\nSee: https://github.com/huggingface/transformers/commit/${{ github.sha }}" &&
git add .
git commit -m "Updated with commit ${{ github.sha }} \n\nSee: https://github.com/huggingface/transformers/commit/${{ github.sha }}"
git push origin main
else
echo "No diff in the documentation."
fi &&
cd .. &&
fi
cd ..
cd notebooks
git pull
cp -r ../notebooks_dir/. transformers_doc/
git status
cd notebooks &&
if [[ `git status --porcelain` ]]; then
git add transformers_doc &&
git add transformers_doc
git commit -m "Updated Transformer doc notebooks with commit ${{ github.sha }} \n\nSee: https://github.com/huggingface/transformers/commit/${{ github.sha }}" &&
git push origin master
else
echo "No diff in the notebooks."
fi &&
fi
cd ..
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment