From fe593e1db8eef85c680501a32b385c8d67f90401 Mon Sep 17 00:00:00 2001 From: "Josh.5" Date: Sat, 7 May 2022 12:53:23 +1200 Subject: [PATCH] Add GitHub actions for auto deploying the site --- .github/workflows/publish.yml | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..31a1a2a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,63 @@ +name: Build and Release + +on: + push: + branches: [ "master" ] + paths-ignore: + - ".github/**" + - "!.github/workflows/**" + pull_request: + branches: [ master ] + +jobs: + Test-Build: + if: github.ref != 'refs/heads/master' + runs-on: ubuntu-latest + steps: + # Checkout + - name: Checkout + uses: actions/checkout@v3 + # Setup NodeJS + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: yarn + # Install + - name: Install + id: install-step + run: | + yarn install --frozen-lockfile + # Build + - name: Build + id: build-step + run: | + yarn build + + Deploy: + runs-on: ubuntu-20.04 + if: github.ref == 'refs/heads/master' + steps: + # Checkout + - name: Checkout + uses: actions/checkout@v3 + # Setup NodeJS + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: yarn + # Install + - name: Install + id: install-step + run: | + yarn install --frozen-lockfile + # Build + - name: Build + id: build-step + run: | + yarn build + # Publish + - name: Publish to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build