42 lines
1.1 KiB
YAML
42 lines
1.1 KiB
YAML
name: Deploy Hugo Site
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy-hugo-site:
|
|
name: Build and Deploy to Server
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Hugo
|
|
uses: peaceiris/actions-hugo@v3
|
|
with:
|
|
hugo-version: "latest"
|
|
extended: true
|
|
|
|
- name: Build Hugo Site
|
|
run: hugo --minify
|
|
|
|
- name: Deploy to Server via SSH
|
|
uses: appleboy/scp-action@v0.1.7
|
|
with:
|
|
host: ${{ secrets.HUGO_SITE_HOST }}
|
|
username: ${{ secrets.HUGO_DEPLOY_USERNAME }}
|
|
password: ${{ secrets.HUGO_DEPLOY_PASSWORD }}
|
|
source: "public/"
|
|
target: "${{ secrets.HUGO_SITE_LOCATION }}/"
|
|
|
|
- name: Restart Hugo Container (Optional)
|
|
uses: appleboy/ssh-action@v1.0.3
|
|
with:
|
|
host: ${{ secrets.HUGO_SITE_HOST }}
|
|
username: ${{ secrets.HUGO_DEPLOY_USERNAME }}
|
|
password: ${{ secrets.HUGO_DEPLOY_PASSWORD }}
|
|
script: |
|
|
docker restart hugo
|