style: default checked bug #75
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 via SSH | |
on: [push, pull_request] | |
jobs: | |
deploy: | |
name: "Deploy" | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
# needs: test | |
steps: | |
- name: Configure SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_KEY" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
cat >>~/.ssh/config <<END | |
Host prod | |
HostName $SSH_HOST | |
User $SSH_USER | |
IdentityFile ~/.ssh/id_rsa | |
StrictHostKeyChecking no | |
END | |
cat ~/.ssh/config | |
env: | |
SSH_USER: ${{ secrets.SSH_USER }} | |
SSH_KEY: ${{ secrets.SSH_KEY }} | |
SSH_HOST: ${{ secrets.SSH_HOST }} | |
- name: Check out the source | |
run: ssh prod 'cd ~/sites/ult && git stash && git fetch && git merge origin/main' | |
- name: Start the server | |
if: ${{ always() }} | |
run: ssh prod 'source ~/.nvm/nvm.sh && cd ~/sites/ult && pnpm i; cd ~/sites/ult/apps/server && npx prisma migrate deploy && npx prisma generate; cd ~/sites/ult && pnpm build && pm2 stop all; pm2 stop all; pm2 restart all && exit 0' |