ericxliu-me/.gitea/workflows/publish.yaml
eric Liu 54b6804061
Some checks failed
CI Hugo Publish / build-and-deploy (push) Failing after 20s
Update .gitea/workflows/publish.yaml
2024-06-12 03:44:12 +00:00

50 lines
1.4 KiB
YAML

name: CI Hugo Publish
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
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: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H git.ericxliu.me >> ~/.ssh/known_hosts
- name: Clone gitea-pages branch
run: |
git clone --branch gitea-pages git@git.ericxliu.me:eric/ericxliu-me.git output
find output -mindepth 1 -not -regex "^.*\/.git\/.*" -delete
- 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@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
- name: Delete Kubernetes pod
run: |
curl -X DELETE ${{ secrets.APISERVER }}/api/v1/namespaces/Hugo/pods/ \
--header "Authorization: Bearer ${{ secrets.TOKEN }}" --insecure