Skip to content

Commit

Permalink
Update aws.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
NetZach777 authored Aug 18, 2024
1 parent 9bcd4ab commit 137c780
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/aws.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Python application CI/CD


on:
push:
branches:
Expand All @@ -16,16 +17,20 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Installation de Git LFS
run: |
# Installez Git LFS
sudo apt-get install git-lfs
# Initialisez Git LFS dans le référentiel
git lfs install
- name: Checkout du code source
uses: actions/checkout@v3
uses: actions/checkout@v2
with:
lfs: true

- name: Installation de Git LFS
uses: actions/git-lfs/install@v1

- name: Configuration de Python 3.9.18
uses: actions/setup-python@v4
uses: actions/setup-python@v2
with:
python-version: "3.9.18"

Expand All @@ -44,17 +49,18 @@ jobs:
run: |
pytest
- name: Deploy sur EC2
- name: deploy sur ec2
env:
PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }}
HOSTNAME: ${{ secrets.HOST }}
USER_NAME: ${{ secrets.EC2_USER }}
PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }}
HOSTNAME: ${{ secrets.HOST }}
USER_NAME: ${{ secrets.EC2_USER }}
run: |
ssh -o StrictHostKeyChecking=no -i <(echo "$PRIVATE_KEY") ${USER_NAME}@${HOSTNAME} '
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} '
cd /home/ubuntu/test_distilbert
git pull
source /home/ubuntu/miniconda3/etc/profile.d/conda.sh
conda activate py39
conda activate py39
pip install -r requirements.txt
nohup uvicorn main:app --host 0.0.0.0 > uvicorn.log 2>&1 &
'
'

0 comments on commit 137c780

Please sign in to comment.