Update .forgejo/workflows/deploy.yaml
All checks were successful
deploy blog / deploy (push) Successful in 59s

This commit is contained in:
XenGi 2026-02-15 16:44:38 +01:00 committed by Ricardo (XenGi) Band
parent e6de2cd933
commit 96a100c59d
Signed by: xengi
SSH key fingerprint: SHA256:jxWM2RTHvxxcncXycwwWkP7HCWb4VREN05UGJTbIPZg

View file

@ -11,18 +11,18 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Install dependencies - name: Install dependencies
run: apk --no-cache add hugo python3 py3-pip git run: apk --no-cache add hugo python3 py3-pip git openssh-client rsync
- name: Check install - name: Check versions
run: | run: |
cat /etc/os-release cat /etc/os-release
git version git version
hugo version hugo version
python --version python --version
- name: Checkout repo - name: Checkout repository
run: | run: |
git clone -b ${{ forgejo.ref_name }} https://git.berlin.ccc.de/cccb-website-team/www.git . git clone -b ${{ forgejo.ref_name }} --recursive https://git.berlin.ccc.de/cccb-website-team/www.git .
git status git status
- name: Install Python depenndencies - name: Install Python depenndencies
@ -31,32 +31,22 @@ jobs:
- name: Render site - name: Render site
run: ./build.sh run: ./build.sh
- name: Setup SSH key - name: Setup SSH
if: forgejo.ref_name == 'staging' env:
SSH_PRIVATE_KEY: ${{ forgejo.ref_name == 'production' && secrets.SSH_PRIVATE_KEY_PRODUCTION || secrets.SSH_PRIVATE_KEY_STAGING }}
run: | run: |
mkdir -p .ssh mkdir -p ~/.ssh
echo ${{ secrets.SSH_PRIVATE_KEY_STAGING }} > .ssh/id_ed25519 printf "%s" "${{ secrets.KNOWN_HOSTS }}" | base64 -d > ~/.ssh/known_hosts
chmod 600 .ssh/id_ed25519 printf "%s" "$SSH_PRIVATE_KEY" | base64 -d > ~/.ssh/id_ed25519
ssh-keygen -f .ssh/id_ed25519 -y > .ssh/id_ed25519.pub chmod 600 ~/.ssh/id_ed25519
cat .ssh/id_ed25519.pub ssh-keygen -f ~/.ssh/id_ed25519 -y > ~/.ssh/id_ed25519.pub
cat ~/.ssh/id_ed25519.pub
- name: Setup SSH key - name: Rsync rendered site
if: forgejo.ref_name == 'production' env:
run: | DEPLOY_DIR: ${{ forgejo.ref_name == 'production' && '/srv/http/www/' || '/srv/http/www-staging/' }}
mkdir -p .ssh run: rsync -var -e 'ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=yes' ./public/ deploy@www.berlin.ccc.de:$DEPLOY_DIR
echo ${{ secrets.SSH_PRIVATE_KEY_PRODUCTION }} > .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' ./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' ./public/ deploy@www.berlin.ccc.de:srv/http/www/
continue-on-error: true
- name: Cleanup - name: Cleanup
run: rm -rf .ssh if: ${{ always() }}
run: rm -rf ~/.ssh