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
This commit is contained in:
@@ -96,19 +96,18 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
NODE_OPTIONS: --max-old-space-size=6656
|
NODE_OPTIONS: --max-old-space-size=6656
|
||||||
run: |
|
run: |
|
||||||
cd doc-build-dev && git pull
|
doc-builder build transformers transformers/docs/source --build_dir build_dir --clean --version pr_$PR_NUMBER --html
|
||||||
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
|
|
||||||
|
|
||||||
- name: Push to repositories
|
- name: Push to repositories
|
||||||
run: |
|
run: |
|
||||||
cd doc-build-dev
|
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
|
git status
|
||||||
|
|
||||||
if [[ `git status --porcelain` ]]; then
|
if [[ `git status --porcelain` ]]; then
|
||||||
git add .
|
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 commit -m "Updated with commit $COMMIT_SHA See: https://github.com/huggingface/transformers/commit/$COMMIT_SHA"
|
||||||
git push origin main
|
git push origin main
|
||||||
else
|
else
|
||||||
|
|||||||
47
.github/workflows/build_documentation.yml
vendored
47
.github/workflows/build_documentation.yml
vendored
@@ -4,6 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
- doc_builder*
|
||||||
- doc-builder*
|
- doc-builder*
|
||||||
- v*-release
|
- v*-release
|
||||||
|
|
||||||
@@ -75,42 +76,54 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git config --global user.name "Hugging Face Doc Builder"
|
git config --global user.name "Hugging Face Doc Builder"
|
||||||
git config --global user.email docs@huggingface.co
|
git config --global user.email docs@huggingface.co
|
||||||
|
|
||||||
|
- name: Create build directory
|
||||||
|
run: |
|
||||||
cd doc-build
|
cd doc-build
|
||||||
git pull origin main
|
git pull
|
||||||
cd ..
|
cd ..
|
||||||
|
mkdir build_dir
|
||||||
cd notebooks
|
mkdir build_dir/transformers
|
||||||
git pull origin master
|
cp doc-build/transformers/_versions.yml build_dir/transformers
|
||||||
cd ..
|
|
||||||
|
|
||||||
- name: Make documentation
|
- name: Make documentation
|
||||||
run: |
|
run: |
|
||||||
cd doc-builder &&
|
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 ..
|
cd ..
|
||||||
env:
|
env:
|
||||||
NODE_OPTIONS: --max-old-space-size=6656
|
NODE_OPTIONS: --max-old-space-size=6656
|
||||||
|
|
||||||
- name: Push to repositories
|
- name: Push to repositories
|
||||||
run: |
|
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
|
if [[ `git status --porcelain` ]]; then
|
||||||
git add . &&
|
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 commit -m "Updated with commit ${{ github.sha }} \n\nSee: https://github.com/huggingface/transformers/commit/${{ github.sha }}" &&
|
|
||||||
git push origin main
|
git push origin main
|
||||||
else
|
else
|
||||||
echo "No diff in the documentation."
|
echo "No diff in the documentation."
|
||||||
fi &&
|
fi
|
||||||
cd .. &&
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cd notebooks
|
||||||
|
git pull
|
||||||
|
cp -r ../notebooks_dir/. transformers_doc/
|
||||||
|
git status
|
||||||
|
|
||||||
cd notebooks &&
|
|
||||||
if [[ `git status --porcelain` ]]; then
|
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 commit -m "Updated Transformer doc notebooks with commit ${{ github.sha }} \n\nSee: https://github.com/huggingface/transformers/commit/${{ github.sha }}" &&
|
||||||
git push origin master
|
git push origin master
|
||||||
else
|
else
|
||||||
echo "No diff in the notebooks."
|
echo "No diff in the notebooks."
|
||||||
fi &&
|
fi
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|||||||
Reference in New Issue
Block a user