Skip to content

Commit

Permalink
Improve version management in tag workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu Boisnard <[email protected]>
  • Loading branch information
mboisnard committed Feb 14, 2021
1 parent 7fdd498 commit 69a008d
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.VERSION }}
steps:
- uses: actions/checkout@v2

Expand All @@ -24,8 +26,11 @@ jobs:
with:
java-version: 8

- id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)

- name: Set current version
run: ./mvnw -B versions:set -DnewVersion=${GITHUB_REF##*/}
run: ./mvnw -B versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }}

- name: Build with Maven
run: ./mvnw -B clean verify
Expand All @@ -41,13 +46,6 @@ jobs:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)

- name: Checkout code
uses: actions/checkout@v2

- name: Checkout artifact
uses: actions/download-artifact@v2
with:
Expand All @@ -60,8 +58,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
tag_name: ${{ needs.build.outputs.version }}
release_name: ${{ needs.build.outputs.version }}
body: |
${{github.event.head_commit.message}}
draft: false
Expand All @@ -73,8 +71,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/keycloak-franceconnect-${{ steps.get_version.outputs.VERSION }}-javadoc.jar
asset_name: keycloak-franceconnect-${{ steps.get_version.outputs.VERSION }}-javadoc.jar
asset_path: ./target/keycloak-franceconnect-${{ needs.build.outputs.version }}-javadoc.jar
asset_name: keycloak-franceconnect-${{ needs.build.outputs.version }}-javadoc.jar
asset_content_type: jar

- name: Upload Release sources
Expand All @@ -83,8 +81,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/keycloak-franceconnect-${{ steps.get_version.outputs.VERSION }}-sources.jar
asset_name: keycloak-franceconnect-${{ steps.get_version.outputs.VERSION }}-sources.jar
asset_path: ./target/keycloak-franceconnect-${{ needs.build.outputs.version }}-sources.jar
asset_name: keycloak-franceconnect-${{ needs.build.outputs.version }}-sources.jar
asset_content_type: jar

- name: Upload Release
Expand All @@ -93,6 +91,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/keycloak-franceconnect-${{ steps.get_version.outputs.VERSION }}.jar
asset_name: keycloak-franceconnect-${{ steps.get_version.outputs.VERSION }}.jar
asset_path: ./target/keycloak-franceconnect-${{ needs.build.outputs.version }}.jar
asset_name: keycloak-franceconnect-${{ needs.build.outputs.version }}.jar
asset_content_type: jar

0 comments on commit 69a008d

Please sign in to comment.