Update the documentation website #257
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: Update the documentation website | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
Update-Submodules: | |
runs-on: ubuntu-latest | |
if: startsWith(github.repository, 'osg-htc/') | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
fetch-depth: 0 | |
- name: Pull, Merge, Push submodules | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git submodule update --remote --merge | |
if [ -n "$(git status --porcelain)" ]; then | |
git add . | |
git commit -m "Update Documentation" | |
git push | |
else | |
echo "no changes"; | |
fi | |
Build-Static-Site: | |
runs-on: ubuntu-latest | |
if: startsWith(github.repository, 'osg-htc/') | |
needs: Update-Submodules | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
submodules: 'recursive' | |
- name: Initialize GH User | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
- name: Update the Submodule pulled | |
run: | | |
git submodule update --recursive --remote | |
- name: Build MkDocs pages | |
if: startsWith(github.repository, 'osg-htc/') | |
uses: docker://squidfunk/mkdocs-material:8.2.8 | |
with: | |
args: >- | |
build | |
--verbose | |
- name: Deploy to 'static' branch | |
run: | | |
# Commit the build then use 'git subtree' to create a branch with just the site contents | |
git add site -f | |
git commit -m "Build Static HTML" | |
git checkout -b static `git subtree split --prefix site main` | |
# Push to Production | |
git push --set-upstream origin static --force | |
Trigger-New-Documentation-Release: | |
runs-on: ubuntu-latest | |
if: startsWith(github.repository, 'osg-htc/') | |
needs: [Build-Static-Site, Update-Submodules] | |
env: | |
OWNER: "osg-htc" | |
REPO: "path-portal" | |
WORKFLOW_ID: "release-documentation-update.yml" | |
steps: | |
- name: Trigger Documentation Release | |
run: | | |
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.REPO_ACCESS_TOKEN }}" https://api.github.com/repos/${{env.OWNER}}/${{env.REPO}}/actions/workflows/${{env.WORKFLOW_ID}}/dispatches -d '{"ref":"master"}' |