Skip to content

Commit

Permalink
Add wiki automation
Browse files Browse the repository at this point in the history
  • Loading branch information
astrsh committed Jul 21, 2022
1 parent 791a69c commit aeeb2c6
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
23 changes: 23 additions & 0 deletions .scripts/upload-to-wiki.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .wiki/Home.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Welcome to the Terra Overworld wiki!

0 comments on commit aeeb2c6

Please sign in to comment.