38 lines
969 B
YAML
38 lines
969 B
YAML
name: CI Hugo Publish
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GITHUB_SERVER_URL: "https://git.ericxliu.me"
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: true # Fetch Hugo themes (true OR recursive)
|
|
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
|
|
|
- name: Build site with Hugo
|
|
uses: peaceiris/actions-hugo@v3
|
|
with:
|
|
hugo-version: '0.119.0'
|
|
extended: true
|
|
|
|
- name: Build
|
|
run: hugo --minify
|
|
|
|
- name: Deploy
|
|
uses: peaceiris/actions-gh-pages@v4
|
|
with:
|
|
deploy_key: ${{ secrets.SSH_KEY }}
|
|
publish_dir: ./public
|
|
|
|
- name: Delete Kubernetes pod
|
|
run: |
|
|
curl -X DELETE ${{ secrets.APISERVER }}/api/v1/namespaces/Hugo/pods/ \
|
|
--header "Authorization: Bearer ${{ secrets.TOKEN }}" --insecure |