This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
fix #162
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 demo' | |
on: | |
push: | |
branches: [main] | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
environment: demo | |
steps: | |
- name: Prepare keys | |
run: | | |
mkdir -p ~/.ssh | |
echo -e "$KEY" > ~/.ssh/id_rsa | |
chmod og-rwx ~/.ssh/id_rsa | |
ssh-keyscan $HOST >> ~/.ssh/known_hosts | |
env: | |
HOST: ${{ secrets.REMOTE_HOST }} | |
KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Deploy | |
run: ssh $USER@$HOST $COMMAND && ssh $USER@$HOST $RESTART | |
env: | |
HOST: ${{ secrets.REMOTE_HOST }} | |
USER: ${{ secrets.REMOTE_USER }} | |
COMMAND: > | |
sudo -u node /home/node/app/postdeploy.sh | |
RESTART: > | |
sudo systemctl restart app.service |