mirror of https://github.com/FabricMC/yarn.git
Dont allow overwriting existing versions (#2357)
Ensure branch name equals mc version
This commit is contained in:
parent
aec7f8ec93
commit
e12dacd26c
|
@ -28,8 +28,9 @@ jobs:
|
||||||
token: ${{ secrets.github_token }}
|
token: ${{ secrets.github_token }}
|
||||||
prefix: ${{ github.ref }}
|
prefix: ${{ github.ref }}
|
||||||
|
|
||||||
- run: ./gradlew build javadocJar publish --stacktrace
|
- run: ./gradlew build javadocJar checkVersion publish --stacktrace
|
||||||
env:
|
env:
|
||||||
MAVEN_URL: ${{ secrets.MAVEN_URL }}
|
MAVEN_URL: ${{ secrets.MAVEN_URL }}
|
||||||
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
|
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
|
||||||
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
||||||
|
VALIDATE_BRANCH: true
|
||||||
|
|
22
build.gradle
22
build.gradle
|
@ -24,6 +24,7 @@ plugins {
|
||||||
id 'java' // for jd gen
|
id 'java' // for jd gen
|
||||||
id 'org.cadixdev.licenser' version '0.5.1'
|
id 'org.cadixdev.licenser' version '0.5.1'
|
||||||
id 'net.fabricmc.filament' version '0.2.0'
|
id 'net.fabricmc.filament' version '0.2.0'
|
||||||
|
id "org.ajoberstar.grgit" version "4.1.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
def minecraft_version = "21w17a"
|
def minecraft_version = "21w17a"
|
||||||
|
@ -35,6 +36,13 @@ def build_number = ENV.BUILD_NUMBER ?: "local"
|
||||||
def yarnVersion = "${minecraft_version}+build.$build_number"
|
def yarnVersion = "${minecraft_version}+build.$build_number"
|
||||||
version = yarnVersion
|
version = yarnVersion
|
||||||
|
|
||||||
|
if (ENV.VALIDATE_BRANCH) {
|
||||||
|
def branch = grgit.branch.current().name
|
||||||
|
if (minecraft_version != branch) {
|
||||||
|
throw new IllegalStateException("Branch name (${branch}) does not match the mc version (${minecraft_version})")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven {
|
maven {
|
||||||
|
@ -1037,6 +1045,20 @@ publishing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A task to ensure that the version being released has not already been released.
|
||||||
|
task checkVersion {
|
||||||
|
doFirst {
|
||||||
|
def xml = new URL("https://maven.fabricmc.net/net/fabricmc/yarn/maven-metadata.xml").text
|
||||||
|
def metadata = new XmlSlurper().parseText(xml)
|
||||||
|
def versions = metadata.versioning.versions.version*.text();
|
||||||
|
if (versions.contains(version)) {
|
||||||
|
throw new RuntimeException("${version} has already been released!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publish.mustRunAfter checkVersion
|
||||||
|
|
||||||
void mapJar(File output, File input, File mappings, File libraries, String from, String to,
|
void mapJar(File output, File input, File mappings, File libraries, String from, String to,
|
||||||
Action<TinyRemapper.Builder> action = { }) {
|
Action<TinyRemapper.Builder> action = { }) {
|
||||||
if (output.exists()) {
|
if (output.exists()) {
|
||||||
|
|
Loading…
Reference in New Issue