Skip to content

Commit b26178a

Browse files
author
姚世权
committed
简化变量
1 parent 9834b5d commit b26178a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.github/workflows/auto-deploy.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,21 @@ jobs:
4343
with:
4444
name: forum-${{ env.VERSION }}.jar
4545
path: target/forum-${{ env.VERSION }}.jar
46+
4647
outputs:
4748
VERSION: ${{ steps.parse_version.outputs.VERSION }}
4849

4950
deploy:
5051
name: Deploy to Server
5152
runs-on: ubuntu-24.04
5253
needs: build
54+
env:
55+
VERSION: ${{ needs.build.outputs.VERSION }}
5356
steps:
5457
- name: Download the JAR file from build job
5558
uses: actions/download-artifact@v4
5659
with:
57-
name: forum-${{ needs.build.outputs.VERSION }}.jar
60+
name: forum-${{ env.VERSION }}.jar
5861
path: ./
5962

6063
- name: Upload the JAR file to server
@@ -63,7 +66,7 @@ jobs:
6366
host: ${{ secrets.HOST }}
6467
username: ${{ secrets.USERNAME }}
6568
password: ${{ secrets.SSH_PASSWORD }}
66-
source: forum-${{ needs.build.outputs.VERSION }}.jar
69+
source: forum-${{ env.VERSION }}.jar
6770
target: /root/project/forum
6871

6972
- name: Start Service
@@ -76,5 +79,5 @@ jobs:
7679
cd /root/project/forum
7780
jps -l | grep -E -i 'forum' | awk '{print "kill "$1}' | sh
7881
rm -rf logs
79-
nohup java -jar forum-${{ needs.build.outputs.VERSION }}.jar --spring.profiles.active=dev >/dev/null 2>&1 &
80-
echo 'forum-${{ needs.build.outputs.VERSION }} service started successfully.'
82+
nohup java -jar forum-${{ env.VERSION }}.jar --spring.profiles.active=dev >/dev/null 2>&1 &
83+
echo 'forum-${{ env.VERSION }} service started successfully.'

0 commit comments

Comments
 (0)