Skip to content

Commit

Permalink
Vérifier l'émplacement de ficher .JAR
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeineb2001 authored Nov 18, 2024
1 parent 89702b6 commit 2b60482
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/catalog-service-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: service-catalog.jar
path: catalog/catalog-service/target/catalog-service-1.0.0-SNAPSHOT-runner.jar
path: catalog/catalog-service/target/*-runner.jar

deploy:
runs-on: ubuntu-latest
Expand All @@ -47,15 +47,30 @@ jobs:
name: service-catalog.jar
path: ./

- name: List files to verify download
run: |
echo "Listing files in the current directory:"
ls -l /home/runner/work/projet-soa-ecommerce-enit-2024-3AINFO2/projet-soa-ecommerce-enit-2024-3AINFO2
- name: Verify if the file exists
run: |
ls /home/runner/work/projet-soa-ecommerce-enit-2024-3AINFO2/projet-soa-ecommerce-enit-2024-3AINFO2/service-catalog.jar
- name: Add Server to Known Hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan -H ${{ secrets.DEPLOYMENT_MACHINE_IP }} >> ~/.ssh/known_hosts
- name: Transfer JAR to VPS
run: |
sshpass -p "${{ secrets.DEPLOYMENT_MACHINE_USER_PSW }}" scp /home/runner/work/projet-soa-ecommerce-enit-2024-3AINFO2/projet-soa-ecommerce-enit-2024-3AINFO2/service-catalog.jar ${{ secrets.DEPLOYMENT_MACHINE_USER }}@${{ secrets.DEPLOYMENT_MACHINE_IP }}:~/service-catalog/service-catalog.jar
# Vérification de la présence du fichier téléchargé
if [ -f "./service-catalog.jar" ]; then
echo "File exists, proceeding with SCP transfer"
sshpass -p "${{ secrets.DEPLOYMENT_MACHINE_USER_PSW }}" scp ./service-catalog.jar ${{ secrets.DEPLOYMENT_MACHINE_USER }}@${{ secrets.DEPLOYMENT_MACHINE_IP }}:~/service-catalog/service-catalog.jar
else
echo "File not found, aborting transfer"
exit 1
fi
- name: Deploy JAR to VPS
uses: appleboy/ssh-action@v0.1.2
Expand Down

0 comments on commit 2b60482

Please sign in to comment.