diff --git a/.github/workflows/deploy-component.yml b/.github/workflows/deploy-component.yml index e77566d..d85f41d 100644 --- a/.github/workflows/deploy-component.yml +++ b/.github/workflows/deploy-component.yml @@ -17,10 +17,12 @@ jobs: - name: Prepare deployment run: bash -c ./service_config/prepare_deployment.sh ./service_config/service_config.json - name: "Deploy on DINO" + id: generate if: ${{ env.TARGET == 'DINO' }} - # ssh into server run: bash -c ./service_config/generate_deployment_script.sh - uses: appleboy/scp-action@master + - uses: appleboy/scp-action@master + id: copy + if: steps.generate.outcome == 'success' with: host: ${{ secrets. SERVER_HOST }} port : ${{ secrets.SERVER_PORT }} @@ -28,7 +30,8 @@ jobs: password: ${{ secrets.SERVER_PASSWORD }} source: "./service_config/deploy_components.sh" target: "/" - uses: appleboy/ssh-action@master + - uses: appleboy/ssh-action@master + if: steps.generate.outcome == 'success' with: host: ${{ secrets. SERVER_HOST }} port : ${{ secrets.SERVER_PORT }} @@ -37,10 +40,9 @@ jobs: script: | pwd ls - chmod +x deploy_components.sh && - ./deploy_components.sh || true && - rm deploy_component.sh - # use MSU to update on SWE + # chmod +x deploy_components.sh && + # ./deploy_components.sh || true && + # rm deploy_component.sh - name: "Deploy on SWE" if: ${{ env.TARGET == 'SWE' }} uses: WSE-research/docker-service-updater@v0.2.1 diff --git a/service_config/generate_deployment_script.sh b/service_config/generate_deployment_script.sh index 266c940..4fb70d5 100755 --- a/service_config/generate_deployment_script.sh +++ b/service_config/generate_deployment_script.sh @@ -5,7 +5,7 @@ env_files=$ENV_FILES outfile="service_config/deploy_components.sh" -echo "" > $outfile +echo "#!/bin/bash" > $outfile file=$1 if [ -z $file ]; then @@ -39,7 +39,7 @@ do echo 'echo "Stopping and removing old container"' >> $outfile echo 'docker stop $container_name || true && docker rm $container_name || true' >> $outfile - echo 'echo "Pulling image: $DOCKER_IMAGE_NAME' >> $outfile + echo 'echo "Pulling image: $DOCKER_IMAGE_NAME"' >> $outfile echo 'docker pull "$image:$tag"' >> $outfile echo 'echo "Starting container: $DOCKER_CONTAINER_NAME"' >> $outfile