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 }}