Update deploy.yml

This commit is contained in:
Filip Koňařík
2023-09-25 14:57:46 +02:00
committed by GitHub
parent 3111fd478f
commit de347b41b0

View File

@@ -1 +1,37 @@
name: Deploy
on:
workflow_dispatch:
workflow_call:
secrets:
SSH_PRIVATE_KEY:
required: true
SSH_HOST:
required: true
SSH_USER:
required: true
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: oauth-playground.online
url: https://sso.oauth-playground.online
steps:
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Download a Build Artifact
uses: actions/download-artifact@v3.0.2
with:
name: server
path: server/
- name: Stop service
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "systemctl stop OAuthServer"
- name: Deploy with rsync
run: rsync -avz server/* ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/oauth-online-server
- name: Start service
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "systemctl start OAuthServer"