Hopefully fix and simplify branch name checking

This commit is contained in:
modmuss50 2021-04-28 23:13:10 +01:00
parent 3126eeea1d
commit 7d53f6d141
2 changed files with 3 additions and 4 deletions

View File

@ -35,4 +35,4 @@ jobs:
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
SIGNING_SERVER: ${{ secrets.SIGNING_SERVER }} SIGNING_SERVER: ${{ secrets.SIGNING_SERVER }}
SIGNING_PGP_KEY: ${{ secrets.SIGNING_PGP_KEY }} SIGNING_PGP_KEY: ${{ secrets.SIGNING_PGP_KEY }}
VALIDATE_BRANCH: true BRANCH_NAME: ${{ github.ref }}

View File

@ -24,7 +24,6 @@ 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"
id "me.modmuss50.remotesign" version "0.1.0" id "me.modmuss50.remotesign" version "0.1.0"
} }
@ -37,8 +36,8 @@ 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) { if (ENV.BRANCH_NAME) {
def branch = grgit.branch.current().name def branch = ENV.BRANCH_NAME.substring(0, ENV.BRANCH_NAME.lastIndexOf('/'))
if (minecraft_version != branch) { if (minecraft_version != branch) {
throw new IllegalStateException("Branch name (${branch}) does not match the mc version (${minecraft_version})") throw new IllegalStateException("Branch name (${branch}) does not match the mc version (${minecraft_version})")
} }