ci(hugo): add Gitea Actions with deploy to 172.20.1.231

This commit is contained in:
2026-02-14 00:55:32 -05:00
parent c4279acc7e
commit 04b24225d4

51
.gitea/workflows/hugo.yml Normal file
View File

@@ -0,0 +1,51 @@
name: Hugo CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.134.0'
extended: true
- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: hugo --minify
- name: Deploy to production server
if: github.ref == 'refs/heads/main'
uses: appleboy/ssh-action@v1.0.0
with:
host: 172.20.1.231
username: root
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
cd /var/www/blog
git pull origin main
hugo --minify
chown -R www-data:www-data /var/www/blog/public
systemctl reload nginx || systemctl reload apache2 || true