1- # This workflow uses actions that are not certified by GitHub.
2- # They are provided by a third-party and are governed by
3- # separate terms of service, privacy policy, and support
4- # documentation.
5- # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6- # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
7-
81name : Gradle
92
103on :
@@ -20,15 +13,19 @@ permissions:
2013
2114jobs :
2215 build :
16+ name : Build
2317 runs-on : ubuntu-latest
2418 permissions :
2519 contents : write
20+ packages : write
21+ outputs :
22+ tag_name : ${{ steps.read-tag-name.outputs.RELEASE_TAG_NAME }}
2623 steps :
24+ # Set up the build environment
2725 - name : Checkout
2826 uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2927 with :
3028 fetch-depth : 0
31- token : ${{ secrets.PUBLISH_KEY }}
3229 - name : Set up JDK 25
3330 uses : actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
3431 with :
@@ -43,29 +40,43 @@ jobs:
4340 - name : Setup Gradle
4441 uses : gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
4542 - name : Build with Gradle
46- run : ./gradlew clean buildDocker
43+ run : ./gradlew clean printVersion buildDocker
4744 - name : Docker Login
4845 uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
4946 with :
5047 username : ${{ secrets.DOCKERHUB_USERNAME }}
5148 password : ${{ secrets.DOCKERHUB_TOKEN }}
52- - name : Tag and publish using Gradle
53- env :
54- ORG_GRADLE_PROJECT_githubUser : ${{ secrets.PUBLISH_USER_NAME }}
55- ORG_GRADLE_PROJECT_githubToken : ${{ secrets.PUBLISH_KEY }}
56- run : ./gradlew tagVersion buildDockerPush
5749 - name : Read tag name
5850 id : read-tag-name
5951 run : |
6052 echo "RELEASE_TAG_NAME=$(cat ./build/version)" >> "$GITHUB_OUTPUT"
61- - name : Generate release
53+ - name : Tag version
54+ run : |
55+ git config --global user.name 'Esta Nagy'
56+ git config --global user.email 'nagyesta@gmail.com'
57+ git tag ${{ steps.read-tag-name.outputs.RELEASE_TAG_NAME }}
58+ git push origin ${{ steps.read-tag-name.outputs.RELEASE_TAG_NAME }}
59+ - name : Publish with Gradle
60+ run : ./gradlew buildDockerPush
61+
62+ create-release :
63+ name : Create Release
64+ runs-on : ubuntu-latest
65+ needs : build
66+ permissions :
67+ contents : write
68+ steps :
69+ - name : Create release
6270 uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
71+ env :
72+ TAG_NAME : ${{needs.build.outputs.tag_name }}
6373 with :
6474 script : |
6575 github.rest.repos.createRelease({
6676 owner: context.repo.owner,
6777 repo: context.repo.repo,
68- tag_name: "${{ steps.read-tag-name.outputs.RELEASE_TAG_NAME }}",
78+ tag_name: "${{ env.TAG_NAME }}",
6979 generate_release_notes: true,
7080 draft: false
7181 });
82+
0 commit comments