Publish Site #812
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: Publish Site | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
jobs: | |
publish: | |
name: Publish Site | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install --fix-missing -y jq p7zip-full libsdl2-2.0-0 libopenal1 | |
- name: Set up Homebrew | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Install Lua Language Server | |
run: | | |
brew install lua-language-server | |
- name: Checkout Source Repository | |
uses: actions/checkout@v2 | |
- name: Generate Dynamic Content | |
run: | | |
bash doc/site/_scripts/get_release_data.sh | |
bash doc/site/_scripts/get_engine_data.sh | |
git add -f doc/site/_data | |
# NOTE: This step is duplicated in `generate-lua-library.yml` | |
- name: Generate Lua library | |
working-directory: rts/Lua/ | |
run: | | |
npm install -g lua-doc-extractor | |
lua-doc-extractor *.cpp --dest library/generated | |
# NOTE: Running LLS 3.13.4 from a subdirectory with a relative path seems | |
# to cause duplicate class fields to be generated. Presumably a bug in | |
# LLS. | |
- name: Export Lua data using Lua Language Server | |
run: | | |
lua-language-server --doc rts/Lua/library --doc_out_path doc/site/_data | |
git add -f doc/site/_data | |
- name: Commit changes | |
run: | | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git commit -m "Update doc/site" | |
- name: Check if gh-pages exists | |
id: check-ghpages | |
run: | | |
git fetch origin gh-pages | |
git ls-remote --exit-code . origin/gh-pages && (echo "exists=true" > $GITHUB_OUTPUT) || (echo "exists=false" > $GITHUB_OUTPUT) | |
- name: Check changes to doc/site | |
id: site-changes | |
if: steps.check-ghpages.outputs.exists == 'true' | |
run: | | |
git diff --stat origin/gh-pages ${{ github.ref_name }}:doc/site | |
git diff --quiet origin/gh-pages ${{ github.ref_name }}:doc/site && (echo "modified=false" > $GITHUB_OUTPUT) || (echo "modified=true" > $GITHUB_OUTPUT) | |
- name: Push gh-pages # Only push gh-pages if doc/site/ was changed or ldoc did changes | |
if: steps.check-ghpages.outputs.exists == 'false' || steps.site-changes.outputs.modified == 'true' | |
run: | | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
git subtree split --prefix=doc/site --rejoin -b gh-pages | |
git push origin gh-pages --force |