Skip to content

Commit

Permalink
Release via github actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 committed Dec 12, 2020
1 parent 0bf152d commit fb7b930
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 31 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,17 @@
name: Release
on: [workflow_dispatch] # Manual trigger
jobs:
build:
runs-on: ubuntu-20.04
container:
image: openjdk:15-jdk
options: --user root
steps:
- uses: actions/checkout@v1
- uses: gradle/wrapper-validation-action@v1
- run: ./gradlew -PincludeSample=false -Prelease build curseforge308769 publish --full-stacktrace
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -52,7 +52,7 @@ Remember to the add a dependency entry to your `fabric.mod.json` file:
}
]
},
"requires": {
"depends": {
"fabric-language-kotlin": ">=1.4.21"
}
}
Expand Down
41 changes: 19 additions & 22 deletions build.gradle.kts
Expand Up @@ -8,7 +8,6 @@ import java.util.Properties

plugins {
kotlin("jvm") version Jetbrains.Kotlin.version
id("moe.nikky.persistentCounter") version "0.0.8-SNAPSHOT"
id("net.minecrell.licenser") version "0.4.1"
id("com.matthewprenger.cursegradle") version CurseGradle.version
id("fabric-loom") version Fabric.Loom.version
Expand All @@ -25,16 +24,11 @@ base {
archivesBaseName = modId
}

val branch = System.getenv("GIT_BRANCH")
?.takeUnless { it == "master" }
?.let { "-$it" }
?: ""

val buildNumber = counter.variable(id = "buildNumber", key = Constants.modVersion + branch)
val buildNumber: String? = System.getenv("GITHUB_RUN_NUMBER")

project.group = group
project.description = description
version = System.getenv("BUILD_NUMBER")?.let { "${modVersion}+build.$buildNumber" }
version = buildNumber?.let { "${modVersion}+build.$buildNumber" }
?: "${modVersion}+local"

java {
Expand Down Expand Up @@ -89,6 +83,7 @@ dependencies {
includeAndExpose(kotlin("reflect", Jetbrains.Kotlin.version))
includeAndExpose(Jetbrains.Annotations.dependency)
includeAndExpose(Jetbrains.KotlinX.Coroutines.core)
includeAndExpose(Jetbrains.KotlinX.Coroutines.coreJvm)
includeAndExpose(Jetbrains.KotlinX.Coroutines.jdk8)
}

Expand Down Expand Up @@ -116,19 +111,24 @@ publishing {
}
}
}
repositories {
maven(url = "http://mavenupload.modmuss50.me/") {
val mavenPass: String? = project.properties["mavenPass"] as String?
mavenPass?.let {
credentials {
username = "buildslave"
password = mavenPass

val maven_url: String? = System.getenv("MAVEN_URL")

if (maven_url != null) {
repositories {
maven(url = maven_url) {
val mavenPass: String? = System.getenv("MAVEN_PASSWORD")
mavenPass?.let {
credentials {
username = System.getenv("MAVEN_USERNAME")
password = mavenPass
}
}
}
}
}
}
val curse_api_key: String? by project
val curse_api_key: String? = System.getenv("CURSEFORGE_API_KEY")
if (curse_api_key != null && project.hasProperty("release")) {
val CURSEFORGE_RELEASE_TYPE: String by project
val CURSEFORGE_ID: String by project
Expand All @@ -151,14 +151,11 @@ if (curse_api_key != null && project.hasProperty("release")) {
addGameVersion("1.16.2")
addGameVersion("1.16.3")
addGameVersion("1.16.4")
addGameVersion("1.17")
addGameVersion("Fabric")

val changelog_file: String? by project
if (changelog_file != null) {
println("changelog = $changelog_file")
changelogType = "markdown"
changelog = file(changelog_file as String)
}
changelog = "See https://github.com/FabricMC/fabric-language-kotlin/commits/master for a changelog"

mainArtifact(
file("${project.buildDir}/libs/${base.archivesBaseName}-${version}.jar"),
closureOf<CurseArtifact> {
Expand Down
4 changes: 0 additions & 4 deletions buildSrc/src/main/kotlin/Util.kt

This file was deleted.

3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Expand Up @@ -18,6 +18,7 @@ object Jetbrains {
object Coroutines {
const val version = "1.4.2"
const val core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"
const val coreJvm = "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$version"
const val jdk8 = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$version"
}

Expand All @@ -30,7 +31,7 @@ object Fabric {
}

object Loom {
const val version = "0.5.12"
const val version = "0.5-SNAPSHOT"
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion sample-mod/src/main/resources/fabric.mod.json
Expand Up @@ -46,7 +46,7 @@
}
]
},
"requires": {
"depends": {
"fabric-language-kotlin": ">=1.4.21"
}
}
2 changes: 1 addition & 1 deletion templates/README.template.md
Expand Up @@ -52,7 +52,7 @@ Remember to the add a dependency entry to your `fabric.mod.json` file:
}
]
},
"requires": {
"depends": {
"fabric-language-kotlin": ">=${KOTLIN_VERSION}"
}
}
Expand Down

0 comments on commit fb7b930

Please sign in to comment.