11name : CD
22
33on :
4- # 输入version
5- workflow_dispatch :
6- inputs :
7- version :
8- description : ' version number'
9- required : true
10- default : ' 0.1.0'
4+ push :
5+ tags :
6+ - ' v*'
117jobs :
128 build_and_push :
139 strategy :
@@ -24,11 +20,15 @@ jobs:
2420 permissions :
2521 contents : write
2622 outputs :
27- version : ${{ inputs .version }}
23+ version : ${{ steps.get_version.outputs .version }}
2824
2925 steps :
3026 - name : Checkout repository
3127 uses : actions/checkout@v4
28+
29+ - name : Get version from tag
30+ id : get_version
31+ run : echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
3232 - uses : coursier/cache-action@v6
3333 - uses : coursier/setup-action@v1
3434 with :
@@ -39,20 +39,20 @@ jobs:
3939 run : sbt clean stage
4040
4141 - name : package
42- run : jpackage --name log-http-proxy --input target/universal/stage/lib --main-jar log-http-proxy.log-http-proxy-${{ inputs .version }}.jar --main-class Main --type app-image
42+ run : jpackage --name log-http-proxy --input target/universal/stage/lib --main-jar log-http-proxy.log-http-proxy-${{ steps.get_version.outputs .version }}.jar --main-class Main --type app-image
4343
4444 - name : Upload macOS artifact
4545 if : matrix.platform.artifact_os_name == 'macos'
4646 uses : actions/upload-artifact@v4
4747 with :
48- name : log-http-proxy-${{ matrix.platform.artifact_os_name }}-${{ inputs .version }}
48+ name : log-http-proxy-${{ matrix.platform.artifact_os_name }}-${{ steps.get_version.outputs .version }}
4949 path : log-http-proxy.app
5050 if-no-files-found : error
5151 - name : Upload Linux/Windows artifact
5252 if : matrix.platform.artifact_os_name != 'macos'
5353 uses : actions/upload-artifact@v4
5454 with :
55- name : log-http-proxy-${{ matrix.platform.artifact_os_name }}-${{ inputs .version }}
55+ name : log-http-proxy-${{ matrix.platform.artifact_os_name }}-${{ steps.get_version.outputs .version }}
5656 path : log-http-proxy
5757 if-no-files-found : error
5858
0 commit comments