Skip to content

Commit

Permalink
Add github actions ci cd pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelphils committed May 17, 2024
1 parent 0a73d40 commit e65e66a
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Smart-Exchange-Deployment

on:
push:
branches: [main, master]

permissions:
id-token: write
contents: read

jobs:
Deploy:
name: Deploy Changes to EC2
runs-on: ubuntu-latest

strategy:
matrix:
node-version: ["20.x"]

steps:
- uses: actions/checkout@v4
name: Checkout code

# - name: Use Node.js
# uses: actions/setup-node@v4
# with:
# node-version: "20.x"

# - name: Install Dependencies
# run: |

- name: SSH and Deploy
env:
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
HOSTNAME: ${{ secrets.EC2_REMOTE_HOST }}
USER_NAME: ubuntu

run: |
echo "$PRIVATE_KEY" > private_key
chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} << 'EOF'
# Now we have got the access of EC2 and we will start the deploy.
cd /home/ubuntu/app/smartchange-backend-v1
sudo systemctl stop smart
npm install
sudo systemctl restart smart
EOF
rm private_key
1 change: 1 addition & 0 deletions text.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Let's check if you're available

0 comments on commit e65e66a

Please sign in to comment.