Skip to content

Commit bb18883

Browse files
committed
using automatic versioning
1 parent 1f85d26 commit bb18883

File tree

4 files changed

+15
-208
lines changed

4 files changed

+15
-208
lines changed

.github/workflows/build-project.yaml

-93
This file was deleted.

.github/workflows/deploy.yaml renamed to .github/workflows/build.yaml

+8-14
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ name: Build and Deploy
55

66
on:
77
push:
8-
branches: [ api-8 ]
9-
8+
branches: [ "*"]
9+
tags-ignore: [ "*" ]
10+
pull_request:
11+
release:
12+
types: [ released ]
1013

1114
jobs:
1215
build:
@@ -41,19 +44,10 @@ jobs:
4144
run: ./gradlew -PenableTestPlugins=true build --stacktrace
4245
env:
4346
CI_SYSTEM: Github Actions
44-
- name: Archive artifacts for build
45-
uses: actions/upload-artifact@v2
46-
with:
47-
name: Sponge Jars
48-
path: |
49-
${{ github.workspace }}/SpongeAPI/build/libs/*.jar
50-
${{ github.workspace }}/build/libs/*.jar
51-
${{ github.workspace }}/vanilla/build/libs/*.jar
52-
${{ github.workspace }}/forge/build/libs/*.jar
53-
- name: SpongeVanilla Production Jar
47+
- name: Server Jar
5448
uses: actions/upload-artifact@v2
5549
with:
56-
name: SpongeVanilla Production Jar
50+
name: Server Jar
5751
path: "${{ github.workspace }}/vanilla/build/libs/*-universal.jar"
5852
integrationTest:
5953
needs: build
@@ -81,7 +75,7 @@ jobs:
8175
- name: Download SpongeVanilla server
8276
uses: actions/download-artifact@v2
8377
with:
84-
name: SpongeVanilla Production Jar
78+
name: Server Jar
8579
- name: Run SpongeVanilla Test (windows)
8680
if: "runner.os == 'Windows'"
8781
run: java -jar $(gci | Where-Object NameString -Match "-universal.jar") --launchTarget sponge_server_it

.github/workflows/legacy_deploy.yaml

-71
This file was deleted.

build.gradle.kts

+7-30
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ plugins {
1010
id("org.spongepowered.gradle.sponge.dev") apply false // for version json generation
1111
id("implementation-structure")
1212
id("org.jetbrains.gradle.plugin.idea-ext")
13+
id("com.palantir.git-version") version "0.12.3"
1314
}
1415

1516
val commonProject = project
@@ -25,13 +26,15 @@ val guavaVersion: String by project
2526
val junitVersion: String by project
2627
val timingsVersion: String by project
2728

29+
val gitVersion: groovy.lang.Closure<String> by extra
30+
2831
val commonManifest = the<JavaPluginConvention>().manifest {
2932
attributes(
3033
"Specification-Title" to "Sponge",
3134
"Specification-Vendor" to "SpongePowered",
3235
"Specification-Version" to apiVersion,
3336
"Implementation-Title" to project.name,
34-
"Implementation-Version" to spongeImpl.generateImplementationVersionString(apiVersion, minecraftVersion, recommendedVersion),
37+
"Implementation-Version" to gitVersion(),
3538
"Implementation-Vendor" to "SpongePowered"
3639
)
3740
}
@@ -71,7 +74,7 @@ tasks {
7174

7275
}
7376

74-
version = spongeImpl.generateImplementationVersionString(apiVersion, minecraftVersion, recommendedVersion)
77+
version = gitVersion()
7578

7679
// Configurations
7780
val applaunchConfig by configurations.register("applaunch")
@@ -280,18 +283,6 @@ allprojects {
280283
}
281284
options.annotationProcessorPath = emptyAnnotationProcessors // hack so IntelliJ doesn't try to run Mixin AP
282285
}
283-
284-
withType(PublishToMavenRepository::class).configureEach {
285-
onlyIf {
286-
(repository == publishing.repositories["GitHubPackages"] &&
287-
!(rootProject.version as String).endsWith("-SNAPSHOT")) ||
288-
(!spongeSnapshotRepo.isNullOrBlank()
289-
&& !spongeReleaseRepo.isNullOrBlank()
290-
&& repository == publishing.repositories["spongeRepo"]
291-
&& publication == publishing.publications["sponge"])
292-
293-
}
294-
}
295286
}
296287
sourceSets.configureEach {
297288
val sourceSet = this
@@ -308,26 +299,12 @@ allprojects {
308299
repositories {
309300
maven {
310301
name = "GitHubPackages"
311-
this.url = uri("https://maven.pkg.github.com/SpongePowered/${rootProject.name}")
302+
this.url = uri("https://maven.pkg.github.com/${System.getenv("GITHUB_REPOSITORY")}")
312303
credentials {
313-
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_USERNAME")
304+
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
314305
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
315306
}
316307
}
317-
// Set by the build server
318-
maven {
319-
name = "spongeRepo"
320-
val repoUrl = if ((version as String).endsWith("-SNAPSHOT")) spongeSnapshotRepo else spongeReleaseRepo
321-
repoUrl?.apply {
322-
url = uri(this)
323-
}
324-
val spongeUsername: String? by project
325-
val spongePassword: String? by project
326-
credentials {
327-
username = spongeUsername ?: ""
328-
password = spongePassword ?: ""
329-
}
330-
}
331308
}
332309
}
333310
}

0 commit comments

Comments
 (0)