aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/jvm.yml38
-rw-r--r--build.gradle.kts12
-rw-r--r--gradle.properties1
3 files changed, 46 insertions, 5 deletions
diff --git a/.github/workflows/jvm.yml b/.github/workflows/jvm.yml
index dd52115..62ba3dd 100644
--- a/.github/workflows/jvm.yml
+++ b/.github/workflows/jvm.yml
@@ -39,8 +39,8 @@ jobs:
- name: Build with Gradle
run: ./gradlew build
- publish-preview:
- name: Publish Preview to GitHub Packages
+ publish-snapshot:
+ name: Publish Snapshot to GitHub Packages
needs: build-and-test
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
@@ -61,5 +61,37 @@ jobs:
java-version: '11'
- name: Build with Gradle
run: ./gradlew build
+ - name: Publish the preview package
+ run: ./gradlew publishAllPublicationsToGitHubPackagesRepository
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+
+ publish-release:
+ name: Publish Packages to Maven Central and GitHub Packages
+ needs: build-and-test
+ if: ${{ github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/') }}
+ runs-on: ubuntu-latest
+ permissions:
+ packages: write
+ contents: write
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ lfs: true
+ - name: Setup Java
+ uses: actions/setup-java@v4
+ with:
+ cache: 'gradle'
+ distribution: 'adopt'
+ java-version: '11'
+ - name: Build with Gradle
+ run: ./gradlew build
- name: Publish the package
- run: ./gradlew publish \ No newline at end of file
+ run: ./gradlew publish
+ env:
+ MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
+ MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index 6d1dfac..491c90f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -47,7 +47,7 @@ publishing {
from(components["java"])
groupId = "io.github.locusts-r-us"
artifactId = "locusts"
- version = "0.1.1"
+ version = "$version"
pom {
name = "Locusts"
description = "A JVM library that introduces locusts into your codebase."
@@ -77,10 +77,18 @@ publishing {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/locusts-r-us/locusts")
credentials {
- username = "oauth2"
+ username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
+ maven {
+ name = "OSSRH"
+ url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
+ credentials {
+ username = System.getenv("MAVEN_USERNAME")
+ password = System.getenv("MAVEN_PASSWORD")
+ }
+ }
}
}
diff --git a/gradle.properties b/gradle.properties
index 18f452c..34886b5 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -4,3 +4,4 @@
org.gradle.parallel=true
org.gradle.caching=true
+version=1.0.0-SNAPSHOT \ No newline at end of file