hugo-example/.forgejo/workflows/build.yaml

57 lines
1.6 KiB
YAML
Raw Normal View History

2024-08-26 15:23:07 +00:00
on:
push:
branches:
- main
jobs:
build:
runs-on: docker
env:
hugo_version: "0.133.1"
hugo_destination: "public"
steps:
- name: Download Hugo
working-directory: /tmp
run: |
wget https://github.com/gohugoio/hugo/releases/download/v${hugo_version}/hugo_extended_${hugo_version}_Linux-64bit.tar.gz
tar zxf hugo_extended_${hugo_version}_Linux-64bit.tar.gz
mv hugo /usr/local/bin/hugo
- uses: actions/checkout@v4
- name: Build Hugo site
run: hugo -d ${hugo_destination}
- name: Create tarball
run: tar zcf /tmp/html.tar.gz ${hugo_destination}
- name: Upload tarball
uses: actions/upload-artifact@v3
with:
name: html.tar.gz
path: /tmp/html.tar.gz
2024-09-06 05:16:26 +00:00
deploy:
needs: build
runs-on: docker
steps:
- name: Download tarball
uses: actions/download-artifact@v3
with:
name: html.tar.gz
path: /tmp
- name: Extract tarball
run: |
tar zxvf /tmp/html.tar.gz -C /tmp
- name: Install Rsync
run: |
apt update && apt install -y rsync
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
cat <<EOF > ~/.ssh/config
Host reason
HostName reason.sailmaker.fenix.lgbt
User correlr
IdentityFile ~/.ssh/id_rsa
StrictHostKeyChecking no
EOF
echo "${{ secrets.ssh_private_key }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: Rsync HTML
run: rsync -avz --delete /tmp/public/ reason:Public/hugo/