Build, test and deploy website (if needed) #109
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# with: | |
# fetch-depth: 0 | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
- name: Build | |
run: hugo --minify | |
# - name: "Fix security.txt" | |
# run: mkdir public/.well-known && (cd public/.well-known && ln -s ../security.txt) && ls -al public/.well-known | |
# - name: ".htaccess" | |
# run: cp .htaccess public/ | |
# - name: Test HTML code | |
# run: | | |
# sudo apt-get update -y | |
# sudo apt-get install python3-pip libcurl4 -y | |
# pip3 install html5validator | |
# sudo gem install --no-document html-proofer | |
# ./proof_html.sh || exit 0 | |
- name: rsync deploy | |
uses: burnett01/[email protected] | |
if: ${{ github.ref == 'refs/heads/main' }} | |
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' }} | |
with: | |
folder: admin # The folder the action should deploy. |