www/.forgejo/workflows/deploy.yaml
xengi 2f0f720bbf
All checks were successful
deploy blog / deploy (push) Successful in 1m9s
Update .forgejo/workflows/deploy.yaml
2026-02-15 17:04:57 +01:00

66 lines
2.1 KiB
YAML

name: deploy blog
on:
workflow_dispatch:
push:
branches:
- staging
- production
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: apk --no-cache add hugo python3 py3-pip git openssh-client rsync
- name: Check install
run: |
cat /etc/os-release
git version
hugo version
python --version
- name: Checkout repo
run: |
git clone -b ${{ forgejo.ref_name }} --recursive https://git.berlin.ccc.de/cccb-website-team/www.git .
git status
- name: Install Python depenndencies
run: python -m pip install -r requirements.txt --break-system-packages
- name: Render site
run: ./build.sh
- name: Setup SSH
run: |
mkdir -p -m0700 .ssh
echo "${{ secrets.KNOWN_HOSTS }}" | base64 -d > .ssh/known_hosts
chmod 644 .ssh/known_hosts
- name: Setup SSH key
if: forgejo.ref_name == 'staging'
run: |
echo "${{ secrets.SSH_PRIVATE_KEY_STAGING }}" | base64 -d > .ssh/id_ed25519
chmod 600 .ssh/id_ed25519
ssh-keygen -f .ssh/id_ed25519 -y > .ssh/id_ed25519.pub
cat .ssh/id_ed25519.pub
- name: Setup SSH key
if: forgejo.ref_name == 'production'
run: |
echo "${{ secrets.SSH_PRIVATE_KEY_PRODUCTION }}" | base64 -d > .ssh/id_ed25519
chmod 600 .ssh/id_ed25519
ssh-keygen -f .ssh/id_ed25519 -y > .ssh/id_ed25519.pub
cat .ssh/id_ed25519.pub
- name: Sync rendered site to staging
if: forgejo.ref_name == 'staging'
run: rsync -var -e 'ssh -i .ssh/id_ed25519 -o HostKeyAlgorithms=ssh-ed25519' ./public/ deploy@www.berlin.ccc.de:srv/http/www-staging/
continue-on-error: true
- name: Sync rendered site to production
if: forgejo.ref_name == 'production'
run: rsync -var -e 'ssh -i .ssh/id_ed25519 -o HostKeyAlgorithms=ssh-ed25519' ./public/ deploy@www.berlin.ccc.de:srv/http/www/
continue-on-error: true
- name: Cleanup
run: rm -rf .ssh