From 0bc657c44326844f4f0db280bc2f17e9c4c07169 Mon Sep 17 00:00:00 2001 From: BCBuizer Date: Sun, 5 Nov 2023 18:20:49 +0100 Subject: [PATCH] Add a GitHub Actions workflow to build and deploy the site --- .github/workflows/cd.yml | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..d5a2378 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,41 @@ +name: Build and Deploy Site + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build-and-deploy-site: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 0 + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: 'latest' + + - name: Build site with Hugo + run: hugo --minify + + - name: Check HTML + uses: chabad360/htmlproofer@master + with: + directory: "./public" + arguments: --only-4xx --check-favicon --check-html --assume-extension --empty-alt-ignore --disable-external + continue-on-error: true + + - name: Deploy to GitHub Pages + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public \ No newline at end of file