Limit scope of .git removal #10
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: Build and Deploy Sphinx Docs | |
on: | |
push: | |
branches: | |
- integrate_docs | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 # Adjust the Python version as needed | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends python3-pip python3-dev git git-lfs zip doxygen build-essential unzip wget pandoc ssh fswatch vim tmux zsh | |
pip3 install --upgrade "sphinx>=3.5,<5" "nbclient<0.6,>=0.2" docutils==0.16 ablog myst-nb rst-to-myst nbsphinx==0.8.8 sphinx-book-theme==0.3.2 sphinx-copybutton sphinx-design sphinx-prompt sphinxcontrib-bibtex sphinx-tabs==3.2.0 exhale==0.2.3 breathe==4.14.1 sphinx-sitemap ipython sphinxcontrib-openapi sphinx-autobuild linkify-it-py | |
- name: Build docs | |
run: | | |
sphinx-build -M html docs/monai-cloud-api/ docs/build/html | |
- name: Deploy to dist branch | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git checkout -b dist | |
# Remove all existing files except the .gitignore file | |
find . -type f ! -path "./docs/*" ! -path "./.git/*" -exec git rm --cached {} + | |
git checkout HEAD -- .gitignore | |
# Copy only the content of the HTML folder to the root of the repository | |
cp -r docs/build/html/. . | |
# Remove the docs folder | |
rm -rf docs | |
# Add all files in the root directory for commit | |
git add . | |
# Commit and push changes | |
git commit -m "Deploy Sphinx documentation to dist branch" | |
git push origin dist |