when: - event: push branch: [main, staging] variables: - &SSH_PORT '2003' steps: build: image: golang:1.23-bookworm environment: HUGO_VERSION: 0.135.0 TZ: Europe/Berlin commands: - wget https://github.com/gohugoio/hugo/releases/download/v$${HUGO_VERSION}/hugo_extended_$${HUGO_VERSION}_linux-amd64.deb && apt install ./hugo_extended_$${HUGO_VERSION}_linux-amd64.deb && rm -f hugo_extended_$${HUGO_VERSION}_linux-amd64.deb - hugo --minify --destination ./public upload-prod: image: alpine:latest when: - branch: main secrets: - RSYNC_SSHKEY - RSYNC_TARGET_SERVER - RSYNC_TARGET_USER environment: TARGET_PATH: /webroot/adora.codes RSYNC_TARGET_PORT: *SSH_PORT commands: - apk add --update --no-cache openssh rsync git - mkdir -p $HOME/.ssh - echo "$RSYNC_SSHKEY" > $HOME/.ssh/id_ed25519 - chmod 0600 $HOME/.ssh/id_ed25519 - ssh-keyscan -t ed25519 -p $RSYNC_TARGET_PORT $RSYNC_TARGET_SERVER >> $HOME/.ssh/known_hosts - rsync -avh -e "ssh -p $RSYNC_TARGET_PORT" --delete ./public/ $RSYNC_TARGET_USER@$RSYNC_TARGET_SERVER:$TARGET_PATH upload-staging: image: alpine:latest when: - branch: staging secrets: - RSYNC_SSHKEY - RSYNC_TARGET_SERVER - RSYNC_TARGET_USER environment: TARGET_PATH: /webroot/www-staging.adora.codes RSYNC_TARGET_PORT: *SSH_PORT commands: - apk add --update --no-cache openssh rsync git - mkdir -p $HOME/.ssh - echo "$RSYNC_SSHKEY" > $HOME/.ssh/id_ed25519 - chmod 0600 $HOME/.ssh/id_ed25519 - ssh-keyscan -t ed25519 -p $RSYNC_TARGET_PORT $RSYNC_TARGET_SERVER >> $HOME/.ssh/known_hosts - rsync -avh -e "ssh -p $RSYNC_TARGET_PORT" --delete ./public/ $RSYNC_TARGET_USER@$RSYNC_TARGET_SERVER:$TARGET_PATH