-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Summary Revised documentation deployments. There are two different workflows. 1. A workflow to generate documentations from the latest development branch (triggered on push event to `develop`) 2. A workflow to generate documentations from the latest release (triggered on publish the a release) The gh-pages environment for this repo will serve the documentations from latest release as default. (https://openvinotoolkit.github.io/datumaro/) but the documentations generated by the latest develop or previous releases could be used by using the different URL like below: * latest develop: https://openvinotoolkit.github.io/datumaro/latest * 1.2.0 release: https://openvinotoolkit.github.io/datumaro/releases/1.2.0 --------- Co-authored-by: Vinnam Kim <vinnam.kim@intel.com>
- Loading branch information
Showing
3 changed files
with
118 additions
and
70 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Build Docs for the latest | ||
|
||
on: | ||
workflow_dispatch: # run on request (no need for PR) | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
Build-Docs: | ||
runs-on: ubuntu-20.04 | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install tox | ||
sudo apt-get install pandoc | ||
- name: Build-Docs | ||
run: | | ||
tox -e build-docs | ||
- name: Create gh-pages branch | ||
run: | | ||
echo RELEASE_VERSION=${GITHUB_REF#refs/*/} >> $GITHUB_ENV | ||
echo SOURCE_NAME=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT | ||
echo SOURCE_BRANCH=${GITHUB_REF#refs/heads/} >> $GITHUB_OUTPUT | ||
echo SOURCE_TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT | ||
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 ${{ env.RELEASE_VERSION }}/* | ||
echo '<html><head><meta http-equiv="refresh" content="0; url=stable/" /></head></html>' > index.html | ||
mkdir -p ${{ env.RELEASE_VERSION }} | ||
cp -r /tmp/docs_build/* ./${{ env.RELEASE_VERSION }} | ||
ln -sfn ${{ env.RELEASE_VERSION }} latest | ||
rm -rf /tmp/docs_build | ||
git config --local user.email "action@github.com" | ||
git config --local user.name "GitHub Action" | ||
git add ./index.html ./latest ${{ env.RELEASE_VERSION }} | ||
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 |
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
This file was deleted.
Oops, something went wrong.