Füge Workflow für automatisches Produktions-Deployment hinzu
Some checks failed
Deploy production / deploy (push) Failing after 2s
Some checks failed
Deploy production / deploy (push) Failing after 2s
This commit is contained in:
33
.gitea/workflows/deploy-production.yml
Normal file
33
.gitea/workflows/deploy-production.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Deploy production
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Deploy auf stechuhr3
|
||||
env:
|
||||
DEPLOY_HOST: ${{ secrets.TIMECLOCK_DEPLOY_HOST }}
|
||||
DEPLOY_USER: ${{ secrets.TIMECLOCK_DEPLOY_USER }}
|
||||
DEPLOY_SSH_PRIVATE_KEY: ${{ secrets.TIMECLOCK_DEPLOY_SSH_PRIVATE_KEY }}
|
||||
DEPLOY_SSH_KNOWN_HOSTS: ${{ secrets.TIMECLOCK_DEPLOY_SSH_KNOWN_HOSTS }}
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
test -n "$DEPLOY_HOST"
|
||||
test -n "$DEPLOY_USER"
|
||||
test -n "$DEPLOY_SSH_PRIVATE_KEY"
|
||||
test -n "$DEPLOY_SSH_KNOWN_HOSTS"
|
||||
|
||||
install -d -m 700 "$HOME/.ssh"
|
||||
printf '%s\n' "$DEPLOY_SSH_PRIVATE_KEY" > "$HOME/.ssh/id_ed25519"
|
||||
chmod 600 "$HOME/.ssh/id_ed25519"
|
||||
printf '%s\n' "$DEPLOY_SSH_KNOWN_HOSTS" > "$HOME/.ssh/known_hosts"
|
||||
chmod 600 "$HOME/.ssh/known_hosts"
|
||||
|
||||
ssh -o BatchMode=yes "$DEPLOY_USER@$DEPLOY_HOST" \
|
||||
'cd /var/www/timeclock && ./deploy-production.sh'
|
||||
Reference in New Issue
Block a user