add deploy script #1
This file contains hidden or 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 on master merge | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| env: | |
| DEPLOY_SERVER: 193.2.72.46 | |
| DEPLOY_USER: notes-deploy-user | |
| steps: | |
| - name: Set up SSH key | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_NOTES_DEPLOY_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| ssh-keyscan -H $DEPLOY_SERVER >> ~/.ssh/known_hosts | |
| - name: Trigger deploy script over SSH | |
| run: | | |
| ARGS="" | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| ARGS="${{ github.head_ref }}" | |
| fi | |
| ssh -o StrictHostKeyChecking=yes $DEPLOY_USER@$DEPLOY_SERVER "${{ github.repository }}" $ARGS |