Skip to content

Commit 400cb4b

Browse files
Merge pull request #449 from oss-slu/439-automatically-create-github-releases
automatic github release creation
2 parents 1ef11a4 + 72d4233 commit 400cb4b

1 file changed

Lines changed: 46 additions & 3 deletions

File tree

.github/workflows/build-reusable.yml

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ jobs:
3434
- name: Execute Gradle shadowJar
3535
working-directory: pi4micronaut-utils
3636
run: ./gradlew shadowJar
37-
38-
37+
- name: Upload built JAR as artifact
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: micronaut-jar
41+
path: pi4micronaut-utils/build/libs/pi4micronaut-utils-*-all.jar
3942

4043
publish-jar:
4144
runs-on: ubuntu-latest
@@ -68,4 +71,44 @@ jobs:
6871
method: 'POST'
6972
- uses: actions/attest-build-provenance@v1
7073
with:
71-
subject-path: 'pi4micronaut-utils/build/libs/**/*.jar'
74+
subject-path: 'pi4micronaut-utils/build/libs/**/*.jar'
75+
create-release:
76+
runs-on: ubuntu-latest
77+
needs: [build-library, publish-jar]
78+
defaults:
79+
run:
80+
working-directory: pi4micronaut-utils
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
83+
steps:
84+
- uses: actions/checkout@v4
85+
with:
86+
fetch-depth: 0
87+
- name: Set up JDK 17
88+
uses: actions/setup-java@v4
89+
with:
90+
java-version: '17'
91+
distribution: 'adopt'
92+
- name: Change wrapper permissions
93+
run: chmod +x pi4micronaut-utils/gradlew
94+
- name: Setup Gradle
95+
uses: gradle/actions/setup-gradle@v4
96+
with:
97+
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
98+
- name: Read library version
99+
id: read_version
100+
working-directory: pi4micronaut-utils
101+
run: |
102+
VERSION=$(./gradlew properties | grep "^version:" | awk '{print $2}')
103+
echo "version=$VERSION" >> $GITHUB_OUTPUT
104+
- name: Download built JAR
105+
uses: actions/download-artifact@v4
106+
with:
107+
name: micronaut-jar
108+
path: build/libs
109+
- name: Create GitHub Release
110+
run: |
111+
gh release create "${{ steps.read_version.outputs.version }}" \
112+
--verify-tag \
113+
--generate-notes \
114+
"build/libs/pi4micronaut-utils-${{ steps.read_version.outputs.version }}-all.jar"

0 commit comments

Comments
 (0)