Skip to content

Generate Docs

Generate Docs #282

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Generate Docs
# Controls when the action will run.
on:
# push:
# branches: [ master ]
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- name: Cached Builds
uses: actions/cache@v4
with:
path: last_cubeengine_*
key: cubeengine-build-no
- name: Fetch Last CubeEngine Builds
id: ce-check
run: |
curl -s "https://api.github.com/repos/CubeEngine/core/actions/workflows/publish.yaml/runs?per_page=1&status=completed&branch=master" | jq '.workflow_runs [0] .run_number' > latest_cubeengine_core
curl -s "https://api.github.com/repos/CubeEngine/modules-main/actions/workflows/publish.yaml/runs?per_page=1&status=completed&branch=master" | jq '.workflow_runs [0] .run_number' > latest_cubeengine_main
curl -s "https://api.github.com/repos/CubeEngine/modules-extra/actions/workflows/publish.yaml/runs?per_page=1&status=completed&branch=master" | jq '.workflow_runs [0] .run_number' > latest_cubeengine_extra
if cmp -s last_cubeengine_core latest_cubeengine_core && cmp -s last_cubeengine_main latest_cubeengine_main && cmp -s last_cubeengine_extra latest_cubeengine_extra; then
echo "modified=false" >> $GITHUB_OUTPUT
echo No New CubeEngine Build $(cat last_cubeengine_core) $(cat last_cubeengine_main) $(cat last_cubeengine_extra)! Skipping
else
echo "modified=true" >> $GITHUB_OUTPUT
echo "New CubeEngine Build: $(cat last_cubeengine_core) $(cat last_cubeengine_main) $(cat last_cubeengine_extra) to $(cat latest_cubeengine_core) $(cat latest_cubeengine_main) $(cat latest_cubeengine_extra)"
mv -f latest_cubeengine_core last_cubeengine_core
mv -f latest_cubeengine_main last_cubeengine_main
mv -f latest_cubeengine_extra last_cubeengine_extra
fi
- name: Cached Libs
if: steps.ce-check.outputs.modified == 'true'
uses: actions/cache@v4
with:
path: data/libraries
key: mc-libraries
- name: Cached World
if: steps.ce-check.outputs.modified == 'true'
uses: actions/cache@v4
with:
path: data/world
key: mc-world
- name: Run minecraft server to generate docs
if: steps.ce-check.outputs.modified == 'true'
run: |
mkdir data
chmod 777 data
docker compose up & sleep 30 && docker compose stop -t 300 && docker compose down
- name: Commit & Push
if: steps.ce-check.outputs.modified == 'true'
run: |
rm docs/README.md
rm -R docs/modules
cp -r data/config/cubeengine/modules/docs/* docs/
ls docs
ls docs/modules
git config user.name github-actions
git config user.email [email protected]
git add docs/
git commit -m "Updated CubeEngine docs" || echo "nothing to commit"
git push