Skip to content

Commit

Permalink
Read version number in gradle-release.yml
Browse files Browse the repository at this point in the history
Set correct permissions for workflow.
And instead of hardcoding, read the version number from gradle.build
  • Loading branch information
hirsivaja committed Dec 28, 2023
1 parent c5e9f6d commit 2cc9695
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/gradle-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

runs-on: ubuntu-latest
permissions:
contents: read
contents: write
packages: write

steps:
Expand All @@ -30,14 +30,17 @@ jobs:
with:
arguments: test jar

- name: Set version number env
run: echo "GITHUB_BUILDVERSION=$(cat build.gradle | grep 'version =' | cut -d"'" -f 2)" >> $GITHUB_ENV

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
tag_name: ${{ env.GITHUB_BUILDVERSION }}
release_name: Java IP Codec v${{ env.GITHUB_BUILDVERSION }}
draft: false
prerelease: false

Expand All @@ -48,6 +51,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/libs/JavaIpCodec-1.0.0.jar
asset_name: JavaIpCodec-1.0.0.jar
asset_path: ./build/libs/JavaIpCodec-${{ env.GITHUB_BUILDVERSION }}.jar
asset_name: JavaIpCodec-${{ env.GITHUB_BUILDVERSION }}.jar
asset_content_type: application/java-archive

0 comments on commit 2cc9695

Please sign in to comment.