Skip to content

add s3 credentials in deploy.yml #20

add s3 credentials in deploy.yml

add s3 credentials in deploy.yml #20

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- main
- 'feature/*'
workflow_dispatch: # allows manual trigger
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: make install
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{secrets.AWS_AWS_REGION}}
- name: Run tests
run: make test
- name: Test SSH connection to EC2
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ubuntu
key: ${{ secrets.EC2_SSH_KEY }}
script: whoami
- name: Deploy to EC2
if: success() # only deploy if previous steps passed
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ubuntu
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd /home/ubuntu/sentiment-mlops
git pull origin main
chmod +x ./deploy.sh
./deploy.sh