Skip to content

Build, test and deploy website (if needed) #92

Build, test and deploy website (if needed)

Build, test and deploy website (if needed) #92

name: build_test_deploy
run-name: Build, test and deploy website (if needed)
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Just
uses: extractions/setup-just@v1
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
- name: Build
run: just build
- name: Test HTML code
uses: Cyb3r-Jak3/[email protected]
with:
root: public
- name: Upload HTML test report
uses: actions/upload-artifact@v3
if: success() || failure() # Run even if we had an error
with:
name: html5validator_log
path: log.log
- name: rsync deploy
uses: burnett01/[email protected]
if: ${{ github.ref == 'refs/heads/main' }} && ( success() || failure() ) # Remove the && clause when a HTML check is flawless
with:
switches: -avzr --delete
path: public/
remote_path: htdocs/beta
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}
- name: Deploy GiutHub pages
uses: JamesIves/github-pages-deploy-action@v4
if: ${{ github.ref == 'refs/heads/main' }} && ( success() || failure() ) # Remove the && clause when a HTML check is flawless
with:
folder: admin # The folder the action should deploy.