File tree Expand file tree Collapse file tree 3 files changed +36
-6
lines changed
Expand file tree Collapse file tree 3 files changed +36
-6
lines changed Original file line number Diff line number Diff line change @@ -2,27 +2,39 @@ name: Package and publish
22
33on :
44 release :
5- types : [created ]
5+ types : [published ]
66
77jobs :
88 build :
99 runs-on : ubuntu-latest
1010 permissions :
11- contents : read
11+ contents : write
1212 packages : write
1313 steps :
1414 - uses : actions/checkout@v4
15+ with :
16+ fetch-depth : 0
17+
1518 - name : Set up JDK 17
1619 uses : actions/setup-java@v4
1720 with :
1821 java-version : " 17"
1922 distribution : " temurin"
2023 server-id : github
21- settings-path : ${{ github.workspace }} # location for the settings.xml file
24+ settings-path : ${{ github.workspace }}
2225
2326 - name : Setup Gradle
2427 uses : gradle/actions/setup-gradle@v4
2528
29+ - name : Extract version from tag
30+ run : |
31+ VERSION=${GITHUB_REF#refs/tags/v}
32+ echo "VERSION=$VERSION" >> $GITHUB_ENV
33+
34+ - name : Update version
35+ run : |
36+ sed -i "s/version=.*/version=$VERSION/" gradle.properties
37+
2638 - name : Build with Gradle
2739 run : ./gradlew s2:build
2840
Original file line number Diff line number Diff line change 44org.gradle.parallel =true
55org.gradle.caching =true
66
7+ group =org.twelvehart
8+ version =0.0.2-SNAPSHOT
9+
10+ # Release plugin configuration
11+ release.useAutomaticVersion =true
12+ release.releaseVersion =0.0.2
13+ release.newVersion =0.0.3-SNAPSHOT
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ plugins {
22 id(" buildlogic.java-library-conventions" )
33 id(" com.google.protobuf" ) version " 0.9.4"
44 id(" maven-publish" )
5+ id(" net.researchgate.release" ) version " 3.1.0"
56}
67
78repositories {
7778publishing {
7879 publications {
7980 create<MavenPublication >(" maven" ) {
80- groupId = " org.twelvehart"
81- artifactId = " s2"
82- version = " 0.0.1"
8381 from(components[" java" ])
8482 }
8583 repositories {
@@ -93,4 +91,17 @@ publishing {
9391 }
9492 }
9593 }
94+ }
95+
96+ release {
97+ git {
98+ requireBranch.set(" main" )
99+ pushToRemote.set(" origin" )
100+ signTag.set(false )
101+ tagTemplate.set(" v\$ {version}" )
102+ }
103+ }
104+
105+ tasks.afterReleaseBuild {
106+ dependsOn(tasks.publish)
96107}
You can’t perform that action at this time.
0 commit comments