add 3d projekt #59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to server | |
on: push | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Configure SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_KEY" > ~/.ssh/staging.key | |
chmod 600 ~/.ssh/staging.key | |
cat >>~/.ssh/config <<END | |
Host staging | |
HostName $SSH_HOST | |
User $SSH_USER | |
IdentityFile ~/.ssh/staging.key | |
UserKnownHostsFile /dev/null | |
StrictHostKeyChecking no | |
END | |
env: | |
SSH_USER: ${{ secrets.SSH_USER }} | |
SSH_KEY: ${{ secrets.SSH_KEY }} | |
SSH_HOST: ${{ secrets.SSH_HOST }} | |
- name: Stop the server | |
run: ssh staging 'supervisorctl stop flask' | |
# - name: Update Steckbriefe | |
# run: ssh staging 'cd ${{ secrets.STECKBRIEFE_PATH }} && git pull' | |
# - name: Update Arbeitsblaetter | |
# run: ssh staging 'cd ${{ secrets.ARBEITSBLAETTER_PATH }} && git pull' | |
- name: Update Flask App | |
run: ssh staging 'cd ${{ secrets.APP_PATH }} && git pull' | |
- name: Start the server | |
# if: ${{ always() }} | |
run: ssh staging 'supervisorctl start flask' |