Skip to content

Commit

Permalink
add github workflow for cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
jaycoolslm committed Jul 6, 2024
1 parent 6c40457 commit 42cb64f
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/prod-cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy

on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
production:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎
uses: actions/checkout@master
- name: Install dependencies 👨🏻‍💻
run: npm i
- name: Build for production 🏗️
run: npm run build
- name: Setup SSH
run: |
mkdir -p ~/.ssh/
echo "${{ secrets.SSH_PRIV_KEY }}" > ~/.ssh/id_rsa
echo "${{ secrets.SSH_PUB_KEY }}" > ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa.pub
ssh-keyscan -H ${{ secrets.SSH_IP }} >> ~/.ssh/known_hosts
- name: copy builds to server
run: |
rsync -vrm dist ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}:/var/www/test-api.gomint.me/
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }} "pm2 restart 0"

0 comments on commit 42cb64f

Please sign in to comment.