mmk2410.org/.forgejo/workflows/deploy.yml

38 lines
993 B
YAML
Raw Normal View History

name: Deploy
on:
push:
branches:
- kirby
jobs:
deploy:
runs-on: docker
container:
image: alpine:3.19
steps:
- name: Install packages
run: apk add --no-cache openssh
- name: Add SSH key
run: |
mkdir ~/.ssh
chmod 700 ~/.ssh
echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
echo "$SSH_KNOWN_HOSTS" | tr -d '\r' >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
env:
SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}}
SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}}
- name: Run deploy script on server
run: |
ssh -p "$SSH_PORT" "$SSH_USER"@"$SSH_HOST" \
2024-03-17 23:01:44 +01:00
"cd /var/www/dev.mmk2410.org && ./deploy.sh $BRANCH"
env:
SSH_USER: ${{secrets.SSH_USER}}
SSH_HOST: ${{secrets.SSH_HOST}}
SSH_PORT: ${{secrets.SSH_PORT}}
BRANCH: ${{vars.BRANCH}}