Skip to content

Commit 78de405

Browse files
authored
Complete CI integration (#5)
So many failed pipeline runs
1 parent caf7abc commit 78de405

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ jobs:
4444
echo version_type=$version_type
4545
echo version_type=$version_type >> $env:GITHUB_ENV
4646
- name: "Publish snapshot"
47-
if: ${{ env.version_type == 'snapshot' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
47+
if: ${{ env.version_type == 'snapshot' && github.event_name == 'push' }}
4848
run: ./gradlew publish
4949
env:
5050
CI_PUBLISH_CORE: ${{ matrix.publish-core }}
5151
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
5252
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
5353
- name: "Publish release"
54-
if: ${{ env.version_type == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
54+
if: ${{ env.version_type == 'release' && github.event_name == 'push' }}
5555
run: ./gradlew --info -PforceSign=true publishToSonatype closeSonatypeStagingRepository
5656
env:
5757
CI_PUBLISH_CORE: ${{ matrix.publish-core }}
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import org.gradle.api.Project
22
import org.gradle.api.provider.Provider
3+
import org.gradle.kotlin.dsl.findByType
4+
import org.gradle.plugins.signing.SigningExtension
35
import java.io.File
46

57
val Project.cpuFeaturesDir: File
@@ -11,8 +13,10 @@ val Project.ci: Provider<Boolean>
1113
val Project.ciPublishCore: Provider<Boolean>
1214
get() = providers.environmentVariable("CI_PUBLISH_CORE").map { it.toBoolean() }.orElse(false)
1315

14-
fun Project.publishCore() {
15-
if (!ci.get() || ciPublishCore.get()) {
16-
plugins.apply("publishing-conventions")
17-
}
16+
fun Project.publishCore(): Boolean {
17+
if (ci.get() && !ciPublishCore.get())
18+
return false
19+
20+
plugins.apply("publishing-conventions")
21+
return true
1822
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
plugins {
22
id("net.kyori.indra.publishing.sonatype")
3+
id("publishing-conventions")
34
}
45

56
indraSonatype {
67
useAlternateSonatypeOSSHost("s01")
78
}
9+
10+
tasks.register("printVersionType") {
11+
doFirst {
12+
println(if (net.kyori.indra.util.Versioning.isSnapshot(project)) "snapshot" else "release")
13+
}
14+
}

build.gradle.kts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ plugins {
33
id("java-conventions")
44
}
55

6-
publishCore()
76

87
group = "io.github.aecsocket"
9-
version = "2.0.1-SNAPSHOT"
8+
version = "2.0.1"
109
description = "Java bindings for Google cpu_features"
1110

1211
dependencies {
@@ -21,8 +20,10 @@ dependencies {
2120
testRuntimeOnly(projects.cpuFeaturesJavaNativesMacosX86)
2221
}
2322

24-
tasks.register("printVersionType") {
25-
doFirst {
26-
println(if (net.kyori.indra.util.Versioning.isSnapshot(project)) "snapshot" else "release")
23+
if (!publishCore()) {
24+
tasks {
25+
withType<PublishToMavenRepository> {
26+
enabled = false
27+
}
2728
}
2829
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)