File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,11 +31,13 @@ jobs:
3131 - uses : actions/checkout@v4
3232 with :
3333 fetch-depth : 0
34+
3435 - name : Extract version from Cargo.toml
3536 run : |
3637 VERSION=$(grep '^version' strong-api-fetch/Cargo.toml | head -n 1 | sed -E 's/version *= *"([^"]+)".*/\1/')
3738 echo "VERSION=$VERSION" >> $GITHUB_ENV
3839 echo "Version extracted: $VERSION"
40+
3941 - name : Check existing tag
4042 id : check_tag
4143 run : |
4850 echo "New version detected: $VERSION"
4951 echo "tag_created=true" >> $GITHUB_OUTPUT
5052 fi
53+
5154 - name : Create and push Git tag
5255 if : steps.check_tag.outputs.tag_created == 'true'
5356 run : |
@@ -64,11 +67,13 @@ jobs:
6467 name : production
6568 steps :
6669 - uses : actions/checkout@v4
70+
6771 - name : Extract version from Cargo.toml
6872 run : |
6973 VERSION=$(grep '^version' strong-api-fetch/Cargo.toml | head -n 1 | sed -E 's/version *= *"([^"]+)".*/\1/')
7074 echo "VERSION=$VERSION" >> $GITHUB_ENV
7175 echo "Version extracted: $VERSION"
76+
7277 - name : SSH into Server and Deploy
7378 env :
7479 PRIVATE_KEY : ${{ secrets.SSH_PRIVATE_KEY }}
@@ -103,5 +108,10 @@ jobs:
103108 fi
104109 echo "Deployment successful - container is running"
105110 EOF
111+
112+ if [ $? -ne 0 ]; then
113+ echo "Deployment failed"
114+ exit 1
115+ fi
106116
107117 rm -f private_key.pem
You can’t perform that action at this time.
0 commit comments