34 lines
1.2 KiB
YAML
34 lines
1.2 KiB
YAML
name: Deploy
|
|
on: [push]
|
|
jobs:
|
|
Deploy:
|
|
runs-on: ubuntu
|
|
env:
|
|
BLOG_FOLDER: /blog
|
|
container:
|
|
volumes:
|
|
- /appli/data/blog:/blog
|
|
steps:
|
|
- name: Check out repository
|
|
run: |
|
|
cd ${BLOG_FOLDER}
|
|
git config --global user.name "Gitea Actions"
|
|
git config --global user.email "actions@local"
|
|
git config --global --add safe.directory ${BLOG_FOLDER}
|
|
git submodule update --init --recursive
|
|
git fetch origin
|
|
git reset --hard origin/main
|
|
|
|
- name: Download Hugo
|
|
run: |
|
|
curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep -oP 'https://[^"]+hugo_extended_[^"]+_Linux-64bit.tar.gz' | head -n 1 | xargs -n 1 curl -L -o hugo.tar.gz
|
|
tar -xzvf hugo.tar.gz -C ${BLOG_FOLDER}/
|
|
|
|
- name: Generate the static files with Hugo
|
|
run: |
|
|
rm -f ${BLOG_FOLDER}/content/posts/template.md
|
|
rm -rf ${BLOG_FOLDER}/private/* ${BLOG_FOLDER}/public/*
|
|
${BLOG_FOLDER}/hugo -D -b https://blog-dev.vezpi.me -s ${BLOG_FOLDER} -d ${BLOG_FOLDER}/private
|
|
${BLOG_FOLDER}/hugo -s ${BLOG_FOLDER} -d ${BLOG_FOLDER}/public
|
|
chown 1000:1000 -R ${BLOG_FOLDER}
|