Merge pull request #19 from FAIR-Universe/neurips_schedule_sync #22
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 Documentation | |
on: | |
push: | |
branches: | |
- master # Trigger on pushes to the main branch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the main repository (if needed) | |
- name: FAIR-Universe.github.io | |
uses: actions/checkout@v2 | |
# Step 2: Checkout the other repository (containing the Sphinx source files) | |
- name: HEP-Challenge | |
uses: actions/checkout@v2 | |
with: | |
repository: FAIR-Universe/HEP-Challenge # The Sphinx source repository | |
token: ${{ secrets.GITHUB_TOKEN }} # Access token stored as a secret | |
path: HEP-Challenge # Checkout to a folder | |
# Step 3: Set up Python | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
# Step 4: Install dependencies | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt # Make sure your Sphinx dependencies are in requirements.txt | |
# Step 5: Build the documentation using make html | |
- name: Build Sphinx Documentation | |
run: | | |
cd HEP-Challenge | |
mkdir -p docs | |
cp -r ../docs/* docs/ | |
mkdir -p docs/pages | |
cp pages/* docs/pages/ | |
cd docs | |
make html | |
# Step 6: Merge new HTML files with existing content | |
- name: Merge Content | |
run: | | |
mkdir -p existing-html | |
cp -r HEP-Challenge/docs/_build/html/* ./docs/ | |
rm -rf HEP-Challenge | |
# Step 7: Configure Git | |
- name: Configure Git | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
# Step 8: Add and Commit Changes | |
- name: Commit built documentation | |
run: | | |
git add . | |
if git diff-index --quiet HEAD; then | |
echo "No changes to commit." | |
exit 0 | |
fi | |
git commit -m "Auto-build Sphinx documentation" | |
# Step 9: Push Changes Back to Master | |
- name: Push changes to master | |
run: | | |
git push origin master |