diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f65260c9..922d7b78 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -78,3 +78,21 @@ jobs: title: "Latest Build" files: | .artifacts/* + + release-docs: + runs-on: ubuntu-latest + needs: release + env: + WIKI_DIRECTORY: .wiki # Contents of this directory get pushed to the wiki + WIKI_PARENT_REPOSITORY: ${{ github.repository }} # Where to publish to + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Upload Documentation to Wiki + run: sh ./.scripts/upload-to-wiki.sh + env: + ACCESS_TOKEN: ${{ secrets.POLYBOT }} diff --git a/.scripts/upload-to-wiki.sh b/.scripts/upload-to-wiki.sh new file mode 100644 index 00000000..75cf0a4b --- /dev/null +++ b/.scripts/upload-to-wiki.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Force pushes the comments of WIKI_DIRECTORY to the wiki page of WIKI_PARENT_REPOSITORY + +if [ "$GITHUB_ACTIONS" != true ]; then + echo "This script must be ran via GitHub actions." + exit 1 +fi + +echo "Deleting .git folder..." +rm -rf .git + +echo "Setting up temporary repository in $WIKI_DIRECTORY..." +cd $WIKI_DIRECTORY +git init + +echo "Committing changes..." +git add * +git commit -m "GitHub Action Deployment" + +echo "Pushing to wiki..." +git remote add origin https://$ACCESS_TOKEN@github.com/$WIKI_PARENT_REPOSITORY.wiki.git +git push origin master --force diff --git a/.wiki/Home.md b/.wiki/Home.md new file mode 100644 index 00000000..78d1e11a --- /dev/null +++ b/.wiki/Home.md @@ -0,0 +1 @@ +Welcome to the Terra Overworld wiki!