Skip to content

Commit c403e23

Browse files
committed
update publishing code
1 parent 2b124dd commit c403e23

File tree

5 files changed

+59
-14
lines changed

5 files changed

+59
-14
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v6
1212

1313
- name: Set up Java
14-
uses: actions/setup-java@v4
14+
uses: actions/setup-java@v5
1515
with:
1616
distribution: temurin
17-
java-version: 21
17+
java-version: 25
1818

1919
- name: Set up Gradle
20-
uses: gradle/actions/setup-gradle@v4
20+
uses: gradle/actions/setup-gradle@v5
2121

2222
- name: Add execute permissions for gradlew
2323
run: chmod +x gradlew

.github/workflows/publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
13+
steps:
14+
- uses: actions/checkout@v6
15+
16+
- name: Set up Java
17+
uses: actions/setup-java@v5
18+
with:
19+
distribution: temurin
20+
java-version: 25
21+
22+
- name: Set up Gradle
23+
uses: gradle/actions/setup-gradle@v5
24+
25+
- name: Add execute permissions for gradlew
26+
run: chmod +x gradlew
27+
28+
- name: Build
29+
run: ./gradlew build
30+
31+
- name: Publish to Maven Central
32+
run: ./gradlew publishToMavenCentral --no-configuration-cache
33+
env:
34+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
35+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
36+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
37+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
38+
39+
- name: Upload JARs to Release
40+
run: |
41+
gh release upload ${{ github.event.release.tag_name }} \
42+
binary/build/libs/binary-*.jar \
43+
json/build/libs/json-*.jar \
44+
--clobber
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build/
66
!**/src/test/**/build/
77

88
### IntelliJ IDEA ###
9-
.idea
9+
.idea/
1010
*.iws
1111
*.iml
1212
*.ipr
@@ -37,4 +37,4 @@ bin/
3737
.vscode/
3838

3939
### Mac OS ###
40-
.DS_Store
40+
.DS_Store

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 mudkip
3+
Copyright (c) 2026 mudkip
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

build.gradle.kts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
import com.vanniktech.maven.publish.SonatypeHost
2-
31
plugins {
42
java
5-
signing
6-
id("com.vanniktech.maven.publish") version "0.32.0"
3+
id("com.vanniktech.maven.publish") version "0.36.0"
74
}
85

96
fun Project.applyPublishingSettings() {
10-
apply(plugin = "signing")
117
apply(plugin = "com.vanniktech.maven.publish")
128

139
mavenPublishing {
1410
coordinates(group.toString(), "${rootProject.name}-${project.name}", version.toString())
15-
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
16-
signAllPublications()
11+
publishToMavenCentral()
12+
13+
if (!gradle.startParameter.taskNames.any { it.contains("publishToMavenLocal") }) {
14+
signAllPublications()
15+
}
1716

1817
pom {
1918
name = project.name

0 commit comments

Comments
 (0)