Created
February 2, 2023 14:24
-
-
Save Valexr/62b3493d73f54389f3221ed53fef298d to your computer and use it in GitHub Desktop.
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '18.13.0' | |
- run: npm i | |
- run: npm run build | |
# Setup key | |
- run: set -eu | |
- run: mkdir "$HOME/.ssh" | |
- run: echo "${{ secrets.DEV_KEY }}" > "$HOME/.ssh/DEV_KEY" | |
- run: chmod 600 "$HOME/.ssh/DEV_KEY" | |
# Deploy bild | |
- run: rsync -e "ssh -i $HOME/.ssh/DEV_KEY -o StrictHostKeyChecking=no" --progress --exclude={".*/","node_modules","src"} --archive --compress --delete . [LOGIN]@[IP]:/var/www/site/ | |
# ssh deploy & restart | |
- name: deploy | |
uses: garygrossgarten/github-action-ssh@release | |
with: | |
command: | | |
cd /var/www/site | |
npm install | |
pm2 restart site --update-env | |
host: [IP] | |
username: [LOGIN] | |
privateKey: ${{ secrets.DEV_KEY }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment