nightly-docs #881
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: nightly-docs | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 6 * * *' | |
jobs: | |
build-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
path: geomesa.github.io | |
- name: Checkout GeoMesa source | |
uses: actions/checkout@v4 | |
with: | |
repository: locationtech/geomesa | |
path: geomesa | |
- name: Check for doc updates | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cd geomesa | |
GMDOCS="$(git log -1 --format=%at docs)" | |
DOCS="$(git log -1 --format=%at pom.xml)" | |
cd ../geomesa.github.io | |
DOCS="$(git log -1 --format=%at documentation/current)" | |
if [[ $DOCS -gt $GMDOCS ]] && [[ $DOCS -gt $GMPOM ]]; then | |
gh run cancel ${{ github.run_id }} | |
gh run watch ${{ github.run_id }} | |
fi | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ./geomesa/docs/requirements.txt | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '8' | |
cache: 'maven' | |
- name: Build docs with Maven | |
run: mvn clean install -Pdocs -pl docs | |
working-directory: ./geomesa | |
- name: Copy docs | |
run: | | |
rm -r ./geomesa.github.io/documentation/current/* | |
cp -r ./geomesa/docs/target/html/* ./geomesa.github.io/documentation/current/ | |
- name: Commit nightly docs | |
working-directory: ./geomesa.github.io | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
git add --all ./documentation/current/ | |
if [[ -n $(git status --porcelain) ]]; then | |
git commit -am "Nightly builds for $(date '+%Y-%m-%d %H:%M')" && git push | |
elif [[ $(git log -1 --format=%cd --date=relative) = '8 weeks ago' ]]; then | |
# add a no-op commit to keep this github action from being disabled | |
echo "" >> ./documentation/current/index.html | |
git add ./documentation/current/index.html | |
git commit -am "Nightly builds for $(date '+%Y-%m-%d %H:%M')" && git push | |
fi |