diff --git a/.github/workflows/catalog-service-ci-cd.yml b/.github/workflows/catalog-service-ci-cd.yml index 270bc221..59232e03 100644 --- a/.github/workflows/catalog-service-ci-cd.yml +++ b/.github/workflows/catalog-service-ci-cd.yml @@ -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 @@ -47,6 +47,15 @@ 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 @@ -54,8 +63,14 @@ jobs: - 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