From 550013a8fff74d4e91baca04fb4db0721faf8db0 Mon Sep 17 00:00:00 2001 From: xengi Date: Fri, 13 Feb 2026 20:52:12 +0100 Subject: [PATCH] Add .forgejo/workflows/deploy.yaml Signed-off-by: xengi --- .forgejo/workflows/deploy.yaml | 62 ++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .forgejo/workflows/deploy.yaml diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml new file mode 100644 index 0000000..506894f --- /dev/null +++ b/.forgejo/workflows/deploy.yaml @@ -0,0 +1,62 @@ +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 + + - name: Check install + run: | + cat /etc/os-release + git version + hugo version + python --version + + - name: Checkout repo + run: | + git clone -b ${{ forgejo.ref_name }} 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 key + if: forgejo.ref_name == 'staging' + run: | + mkdir -p .ssh + echo ${{ secrets.SSH_PRIVATE_KEY_STAGING }} > .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: | + mkdir -p .ssh + 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 + run: rm -rf .ssh