Skip to content

Commit f428652

Browse files
authored
Build and publish with GitHub actions (#46)
1 parent 482f95d commit f428652

File tree

6 files changed

+56
-218
lines changed

6 files changed

+56
-218
lines changed

.github/workflows/build-prs.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Build and test PRs
2+
3+
on:
4+
pull_request:
5+
types:
6+
- synchronize
7+
- opened
8+
- ready_for_review
9+
- reopened
10+
push:
11+
branches:
12+
- 'feature/**'
13+
workflow_dispatch:
14+
15+
jobs:
16+
build:
17+
uses: neoforged/actions/.github/workflows/build-prs.yml@main
18+
with:
19+
java: 17
20+
gradle_tasks: test

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
7+
permissions:
8+
contents: read
9+
statuses: write
10+
11+
jobs:
12+
release:
13+
uses: neoforged/actions/.github/workflows/gradle-publish.yml@main
14+
with:
15+
java: 17
16+
pre_gradle_tasks: test
17+
gradle_tasks: publish
18+
secrets:
19+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
20+
MAVEN_USER: ${{ secrets.MAVEN_USER }}
21+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

.teamcity/pom.xml

Lines changed: 0 additions & 104 deletions
This file was deleted.

.teamcity/settings.kts

Lines changed: 0 additions & 68 deletions
This file was deleted.

build.gradle

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import net.neoforged.gradleutils.PomUtilsExtension.License
2+
13
buildscript {
24
dependencies {
35
classpath('de.jjohannes.gradle:extra-java-module-info:0.14')
@@ -6,7 +8,7 @@ buildscript {
68

79
plugins {
810
id 'com.github.ben-manes.versions' version '0.42.0'
9-
id 'net.neoforged.gradleutils' version '[2.0.16,3)'
11+
id 'net.neoforged.gradleutils' version '3.0.0-alpha.4'
1012
}
1113

1214
apply plugin: 'maven-publish'
@@ -21,7 +23,7 @@ allprojects {
2123
toolchain.languageVersion = JavaLanguageVersion.of(16)
2224
modularity.inferModulePath.set(true)
2325
}
24-
version = gradleutils.getTagOffsetVersion()
26+
version = gradleutils.version
2527

2628
repositories {
2729
mavenLocal()
@@ -112,7 +114,7 @@ compileTestJava {
112114

113115
group = 'cpw.mods'
114116

115-
version = gradleutils.getTagOffsetVersion()
117+
version = gradleutils.version
116118
logger.lifecycle('Version: ' + version)
117119

118120
ext.asmVersion = 9.3
@@ -125,42 +127,24 @@ dependencies {
125127
}
126128

127129
changelog {
128-
fromTag "0.9"
130+
from '0.9'
129131
}
130132

131-
task sourcesJar(type: Jar) {
132-
archiveClassifier = 'sources'
133-
from sourceSets.main.allSource
133+
java {
134+
withSourcesJar()
134135
}
135136

136-
//jmh {
137-
// benchmarkMode = ['avgt' ]
138-
// profilers = [ 'stack', 'jfr:dir=./build/results/jmh/' ]
139-
// timeOnIteration = '3s'
140-
// warmup = '2s'
141-
// warmupIterations = 3
142-
// iterations = 3
143-
// fork = 3
144-
// timeUnit = 'us'
145-
// // JMH loads the main sourceset without a module context, so add exports and opens for required stuff to all unnamed and disable the missing module crash
146-
// jvmArgsPrepend = ['--add-opens java.base/java.util.jar=ALL-UNNAMED --add-exports java.base/sun.security.util=ALL-UNNAMED -Dsecurejarhandler.throwOnMissingModule=false']
147-
//}
148-
149-
//tasks['jmh'].dependsOn(clean)
150-
151137
jar {
152138
manifest {
153139
attributes(
154140
'Specification-Title': 'securejarhandler',
155-
'Specification-Vendor': 'neoforged',
141+
'Specification-Vendor': 'mcmodlauncher',
156142
'Specification-Version': '1', // We are version 1 of ourselves
157143
'Implementation-Title': project.name,
158-
'Implementation-Version': "${project.version}+${System.getenv('BUILD_NUMBER')?:0}+${gradleutils.gitInfo.branch}.${gradleutils.gitInfo.abbreviatedId}",
159-
'Implementation-Vendor':'neoforged',
160-
'Implementation-Timestamp': java.time.Instant.now().toString(),
144+
'Implementation-Version': "${project.version}+${gradleutils.gitInfo.branch}.${gradleutils.gitInfo.abbreviatedId}",
145+
'Implementation-Vendor':'mcmodlauncher',
161146
'Git-Commit': gradleutils.gitInfo.abbreviatedId,
162-
'Git-Branch': gradleutils.gitInfo.branch,
163-
'Build-Number': "${System.getenv("BUILD_NUMBER")?:0}",
147+
'Git-Branch': gradleutils.gitInfo.branch
164148
)
165149
}
166150
}
@@ -178,16 +162,8 @@ publishing {
178162
pom {
179163
name = 'Secure Modular Jar handler'
180164
description = 'Making the Java modular system provide security information'
181-
url = 'https://github.com/McModLauncher/securejarhandler'
182-
scm {
183-
url = 'https://github.com/McModLauncher/securejarhandler'
184-
connection = 'scm:git:git://github.com/McModLauncher/securejarhandler.git'
185-
developerConnection = 'scm:git:git@github.com:McModLauncher/securejarhandler.git'
186-
}
187-
issueManagement {
188-
system = 'github'
189-
url = 'https://github.com/McModLauncher/securejarhandler/issues'
190-
}
165+
pomUtils.githubRepo(it, 'SecureJarHandler', 'McModLauncher')
166+
pomUtils.license(it, License.MIT)
191167

192168
developers {
193169
developer {
@@ -199,6 +175,6 @@ publishing {
199175
}
200176
}
201177
repositories {
202-
maven gradleutils.getPublishingForgeMaven()
178+
maven gradleutils.maven
203179
}
204180
}

settings.gradle

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
pluginManagement {
2-
repositories {
3-
gradlePluginPortal()
4-
maven { url = 'https://maven.neoforged.net/releases' }
5-
}
6-
}
7-
81
plugins {
92
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0'
103
}

0 commit comments

Comments
 (0)