1+ # SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2+ #
3+ # SPDX-License-Identifier: MPL-2.0
4+
5+ name : Release to Maven central
6+
7+ on :
8+ workflow_dispatch :
9+ inputs :
10+ version :
11+ type : string
12+ description : Version tag
13+ required : true
14+
15+ concurrency :
16+ group : ${{ github.workflow }}-${{ github.ref }}
17+ cancel-in-progress : true
18+
19+ jobs :
20+
21+ publish :
22+ name : Publish to Maven central
23+ runs-on : ubuntu-latest
24+ environment : release
25+ permissions :
26+ contents : read
27+
28+ steps :
29+ - name : Checkout repository
30+ uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
31+ with :
32+ fetch-depth : 1
33+ persist-credentials : false
34+
35+ - name : Setup runtime
36+ uses : ./.github/actions/setup-runtime
37+
38+ - name : Cache Gradle
39+ uses : actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
40+ with :
41+ path : |
42+ ~/.gradle/caches
43+ ~/.gradle/wrapper
44+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/settings.gradle*') }}
45+
46+ - name : Optimize Gradle
47+ shell : bash
48+ run : |
49+ mkdir -p ~/.gradle
50+ echo "org.gradle.caching=true" >> ~/.gradle/gradle.properties
51+ echo "org.gradle.configuration-cache=true" >> ~/.gradle/gradle.properties
52+
53+ - name : generate GitHub App token
54+ uses : actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
55+ id : generate-token
56+ with :
57+ client-id : ${{ secrets.RELEASE_BOT_APP_ID }}
58+ private-key : ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
59+ repositories : ${{ github.repository }}
60+ permission-contents : write
61+
62+ - name : Create GitHub release
63+ uses : softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
64+ with :
65+ tag_name : ${{ inputs.version }}
66+ generate_release_notes : true
67+ target_commitish : ${{ github.sha }}
68+ token : ${{ steps.generate-token.outputs.token }}
69+
70+ - name : Gradle Release Build
71+ env :
72+ JRELEASER_GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
73+ JRELEASER_GPG_PUBLIC_KEY : ${{ secrets.GPG_PUBLIC_KEY }}
74+ JRELEASER_GPG_SECRET_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
75+ JRELEASER_MAVENCENTRAL_USERNAME : ${{ secrets.MAVEN_USERNAME }}
76+ JRELEASER_MAVENCENTRAL_PASSWORD : ${{ secrets.MAVEN_PASSWORD }}
77+ run : |
78+ echo "Performing release Gradle publish for tag: ${{ inputs.version }}"
79+
80+ ./gradlew clean build publish -Pversion=${{ inputs.version }}
81+ ./gradlew jreleaserDeploy -Pversion=${{ inputs.version }}
0 commit comments