47 lines
1.2 KiB
YAML
47 lines
1.2 KiB
YAML
name: Build and Deploy Hugo
|
|
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build_and_deploy:
|
|
if: github.event.pull_request.merged == true
|
|
name: Deploy Hugo Website
|
|
runs-on: self-hosted
|
|
|
|
container:
|
|
image: debian:bookworm-slim
|
|
|
|
steps:
|
|
- name: Install dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y git curl ca-certificates
|
|
|
|
- name: Checkout code
|
|
run: |
|
|
git clone --recurse-submodules https://gitea.arnodo.fr/Damien/Notebook.git /tmp/workspace
|
|
cd /tmp/workspace
|
|
git checkout ${{ github.sha }}
|
|
|
|
- name: Install Hugo
|
|
run: |
|
|
curl -L https://github.com/gohugoio/hugo/releases/download/v0.108.0/hugo_0.108.0_linux-amd64.tar.gz -o hugo.tar.gz
|
|
tar -xzf hugo.tar.gz
|
|
mv hugo /usr/local/bin/
|
|
hugo version
|
|
|
|
- name: Build site
|
|
run: hugo
|
|
working-directory: /tmp/workspace
|
|
|
|
- name: Deploy to S3
|
|
run: hugo deploy --force --maxDeletes -1
|
|
working-directory: /tmp/workspace
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.SCW_ACCESS_KEY }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.SCW_SECRET_KEY }}
|