Skip to content

Commit 72ef2fb

Browse files
author
Armin Schrenk
committed
Update workflow "build" to read out and propagate the version
1 parent 94643c5 commit 72ef2fb

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ jobs:
77
build:
88
name: Build and Test
99
runs-on: ubuntu-latest
10+
outputs:
11+
artifact-version: ${{ steps.setversion.outputs.version }}
1012
steps:
1113
- uses: actions/checkout@v2
1214
- uses: actions/setup-java@v1
@@ -21,12 +23,17 @@ jobs:
2123
- name: Ensure to use tagged version
2224
run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags'
2325
if: startsWith(github.ref, 'refs/tags/')
26+
- name: Export the build version to the environment and fix it as an ouput of this job
27+
id: setversion
28+
run: |
29+
echo "::set-env name=BUILD_VERSION::$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout)"
30+
echo "::set-output name=version::${BUILD_VERSION}"
2431
- name: Build and Test
2532
run: mvn -B install
26-
- name: Upload cryptomator-cli-XXX.jar
33+
- name: Upload snapshot artifact cryptomator-cli-${{ BUILD_VERSION }}.jar
2734
uses: actions/upload-artifact@v2
2835
with:
29-
name: cryptomator-cli.jar
36+
name: cryptomator-cli-${{ BUILD_VERSION }}.jar
3037
path: target/cryptomator-cli-*.jar
3138

3239
release:
@@ -38,7 +45,7 @@ jobs:
3845
- name: Download cryptomator-cli.jar
3946
uses: actions/download-artifact@v1
4047
with:
41-
name: cryptomator-cli.jar
48+
name: cryptomator-cli-${{ needs.build.outputs.artifact-version }}.jar
4249
path: .
4350
- name: Create Release
4451
id: create_release
@@ -59,5 +66,5 @@ jobs:
5966
with:
6067
upload_url: ${{ steps.create_release.outputs.upload_url }}
6168
asset_path: cryptomator-cli.jar
62-
asset_name: cryptomator-cli-${{ github.ref }}.jar
69+
asset_name: cryptomator-cli-${{ needs.build.outputs.artifact-version }}.jar
6370
asset_content_type: application/jar

0 commit comments

Comments
 (0)