From 4acec32a1f6387aaffcff86d44f07d9aebb769fa Mon Sep 17 00:00:00 2001 From: Nathan Vaughn Date: Sun, 1 Sep 2019 13:12:50 -0500 Subject: [PATCH] Update for github actions --- .github/workflows/main.yml | 26 ++++++++++++++++++++++++++ build.py | 30 ------------------------------ deploy.py | 19 ------------------- 3 files changed, 26 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 build.py delete mode 100644 deploy.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..7a06ea0e --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,26 @@ +name: Build + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@master + with: + submodules: true + - name: Build site + uses: peaceiris/actions-hugo@master + if: github.event.deleted == false + with: + args: --cleanDestinationDir + - name: Deploy site + uses: peaceiris/actions-gh-pages@master + if: success() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PUBLISH_BRANCH: gh-pages + PUBLISH_DIR: ./public diff --git a/build.py b/build.py deleted file mode 100644 index 95a0bf34..00000000 --- a/build.py +++ /dev/null @@ -1,30 +0,0 @@ -import glob -import os -import shutil -import subprocess -import sys -import time - - -def main(): - os.chdir("public") - subprocess.call(["git", "submodule", "update"]) - time.sleep(1) - subprocess.call(["git", "reset", "--hard", "master"]) - time.sleep(1) - os.chdir("..") - delete_folder_contents("public") - time.sleep(1) - subprocess.call(["hugo"]) - -def delete_folder_contents(folder): - pattern = folder + '/*' - r = glob.glob(pattern) - for i in r: - if os.path.isfile(i): - os.remove(i) - elif os.path.isdir(i): - shutil.rmtree(i) - -if __name__ == "__main__": - main() diff --git a/deploy.py b/deploy.py deleted file mode 100644 index 167672d6..00000000 --- a/deploy.py +++ /dev/null @@ -1,19 +0,0 @@ -import os -import subprocess -import sys - - -def main(): - os.chdir("public") - subprocess.call(["git", "checkout", "master"]) - subprocess.call(["git", "add", "."]) - subprocess.call(["git", "commit", "-m", sys.argv[1]]) - subprocess.call(["git", "push", "-f", "origin", "master"]) - - os.chdir("..") - subprocess.call(["git", "add", "."]) - subprocess.call(["git", "commit", "-m", sys.argv[1]]) - subprocess.call(["git", "push", "-f", "origin", "master"]) - -if __name__ == "__main__": - main()