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: Get current Hugo version run: echo "current_version=$(${BLOG_FOLDER}/hugo version | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+')" | tee -a $GITEA_ENV - name: Verify latest Hugo version run: echo "latest_version=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep -oP '\"tag_name\": \"\K[^\"]+')" | tee -a $GITEA_ENV - name: Download latest Hugo version if: env.current_version != env.latest_version run: | rm -f ${BLOG_FOLDER}/{LICENSE,README.md,hugo} curl -L https://github.com/gohugoio/hugo/releases/download/$latest_version/hugo_extended_${latest_version#v}_Linux-64bit.tar.gz -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}