Skip to content

Commit 7c1d532

Browse files
committed
Adding snapshot deployments
1 parent 929ff7e commit 7c1d532

File tree

3 files changed

+61
-4
lines changed

3 files changed

+61
-4
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ name: Publish to Maven Central
33
on:
44
release:
55
types: [released]
6+
tags:
7+
- 'v[0-9]+.[0-9]+.[0-9]+'
68

79
jobs:
810
build:
11+
if: github
912
runs-on: ubuntu-latest
1013
steps:
1114
- uses: actions/checkout@v4
@@ -23,6 +26,8 @@ jobs:
2326
# Needs to have access to the io.github.ArchipelagoMW namespace in maven central
2427
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.mavenCentralUsername }}
2528
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.mavenCentralToken }}
29+
# JRELEASER_DEPLOY_MAVEN_NEXUS2_USERNAME: ${{ secrets.mavenCentralUsername }}
30+
# JRELEASER_DEPLOY_MAVEN_NEXUS2_TOKEN: ${{ secrets.mavenCentralToken }}
2631
# The content uploaded to maven central needs to be signed. The public keys need to be published,
2732
# see https://central.sonatype.org/publish/requirements/gpg/#distributing-your-public-key for accepted
2833
# locations

.github/workflows/snapshot.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
release:
5+
types: [prereleased]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Set up JDK 17
13+
uses: actions/setup-java@v4
14+
with:
15+
java-version: '17'
16+
distribution: 'temurin'
17+
cache: gradle
18+
- name: Build with Gradle
19+
# This just publishes to the local file system; jreleaser is responsible for uploading to maven central
20+
run: gradlew publish
21+
- name: Upload to Maven Central Snapshots
22+
env:
23+
# Needs to have access to the io.github.ArchipelagoMW namespace in maven central
24+
JRELEASER_DEPLOY_MAVEN_NEXUS2_USERNAME: ${{ secrets.mavenCentralUsername }}
25+
JRELEASER_DEPLOY_MAVEN_NEXUS2_TOKEN: ${{ secrets.mavenCentralToken }}
26+
# The content uploaded to maven central needs to be signed. The public keys need to be published,
27+
# see https://central.sonatype.org/publish/requirements/gpg/#distributing-your-public-key for accepted
28+
# locations
29+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.gpgPassphrase }}
30+
# The content here needs to be the values of the public and secret key pair
31+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.gpgPublicKey }}
32+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.gpgSecretKey }}
33+
run: gradlew jreleaserDeploy

build.gradle.kts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ plugins {
66
id("org.jreleaser") version "1.17.0"
77
}
88

9-
group = "io.github.ArchipelagoMW"
10-
version = "0.1.20"
9+
group = "io.github.cjmang"
10+
version = "0.1.20-rc1"
1111

1212
repositories {
1313
mavenCentral()
@@ -127,6 +127,12 @@ publishing {
127127
}
128128

129129
jreleaser {
130+
project {
131+
snapshot {
132+
// https://regex101.com/r/TYV89b/1
133+
pattern = "^[^-]*-(SNAPSHOT|rc.*)"
134+
}
135+
}
130136
signing {
131137
active = Active.ALWAYS
132138
armored = true
@@ -142,10 +148,23 @@ jreleaser {
142148
deploy {
143149
maven {
144150
mavenCentral {
145-
register("javaClient") {
146-
active = Active.ALWAYS
151+
register("release-deploy") {
152+
// Turning off releases for testing purposes
153+
active = Active.NEVER
154+
applyMavenCentralRules = true
155+
url = "https://central.sonatype.com/api/v1/publisher"
156+
stagingRepository("build/staging-deploy")
157+
}
158+
}
159+
nexus2 {
160+
register("snapshot-deploy") {
161+
active = Active.SNAPSHOT
147162
applyMavenCentralRules = true
163+
snapshotSupported = true
164+
closeRepository = true
165+
releaseRepository = true
148166
url = "https://central.sonatype.com/api/v1/publisher"
167+
snapshotUrl = "https://central.sonatype.com/repository/maven-snapshots/"
149168
stagingRepository("build/staging-deploy")
150169
}
151170
}

0 commit comments

Comments
 (0)