From f482483ae4a7423efcdb9a6bd1084e39c61b59fd Mon Sep 17 00:00:00 2001 From: simonpoole Date: Tue, 11 Aug 2026 16:29:36 +0200 Subject: [PATCH] Add github release publishing and update sonatype config Resolves https://github.com/simonpoole/ConditionalRestrictionParser/issues/4 --- .github/workflows/javalib.yml | 7 ++-- build.gradle | 41 ++++++++++++++++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/.github/workflows/javalib.yml b/.github/workflows/javalib.yml index 65a4144..8e52259 100644 --- a/.github/workflows/javalib.yml +++ b/.github/workflows/javalib.yml @@ -20,11 +20,14 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} steps: - - uses: actions/checkout@v1 + - name: set up JDK 11 uses: actions/setup-java@v1 with: java-version: 11 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - uses: actions/checkout@v1 - name: Dummy gradle.properties shell: bash run: | @@ -38,7 +41,7 @@ jobs: run: ./gradlew test - name: Upload Test Results if: ${{ always() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Test output path: /home/runner/work/ConditionalRestrictionParser/ConditionalRestrictionParser/build/reports/tests/test/ diff --git a/build.gradle b/build.gradle index c8ff9bd..213279d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,19 @@ /* */ +buildscript { + repositories { + maven { + url "https://plugins.gradle.org/m2/" + } + } + dependencies { + classpath "com.github.breadmoirai:github-release:2.5.2" + } +} plugins { id "ca.coglinc.javacc" version "2.4.0" - id "org.sonarqube" version "4.0.0.2929" + id "org.sonarqube" version "6.2.0.5505" } // Apply the java plugin to add support for Java @@ -12,9 +22,9 @@ apply plugin: 'eclipse' apply plugin: 'maven-publish' apply plugin: 'signing' apply plugin: "jacoco" +apply plugin: "com.github.breadmoirai.github-release" - -version = '0.3.4' +version = '0.3.5' sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -112,6 +122,7 @@ test { ext { repoUrl = 'https://github.com/simonpoole/ConditionalRestrictionParser.git' spdxId = 'MIT' + githubToken = System.getenv('GITHUB_TOKEN') } publishing { @@ -144,12 +155,9 @@ publishing { repositories { maven { name = 'sonatype' - credentials { - username System.getenv('SONATYPE_USER') - password System.getenv('SONATYPE_PASSWORD') - } - def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" - def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" + credentials(PasswordCredentials) + def releasesRepoUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/" + def snapshotsRepoUrl = "https://ossrh-staging-api.central.sonatype.com/content/repositories/snapshots/" url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl } } @@ -161,6 +169,21 @@ signing { sign publishing.publications.Release } +githubRelease { + token project.ext.githubToken == null ? "" : project.ext.githubToken + repo = "ConditionalRestrictionParser" + owner = "simonpoole" + tagName = project.version + releaseName = project.version + targetCommitish = "master" + generateReleaseNotes = true + overwrite = true +} + +afterEvaluate { + publishReleasePublicationToSonatypeRepository.dependsOn tasks.githubRelease +} + // In this section you declare where to find the dependencies of your project repositories { mavenCentral() diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 84a0b92..1e2fbf0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists