From b0266cd14bf1c4bdb808046c2f752b416d7dfdba Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Wed, 1 Jun 2022 15:49:41 -0600 Subject: [PATCH] do beta versioning on gh action builds --- .github/workflows/gradle_build.yml | 16 +++++++++++++++- build.gradle | 2 +- gradle.properties | 18 ++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 gradle.properties diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index 34e93bff2..53081763a 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -19,7 +19,21 @@ jobs: with: java-version: '8' distribution: 'adopt' - + + - uses: actions/github-script@v2 + id: fname + name: apply beta versioning + with: + result-encoding: string + script: | + const fs = require("fs"); + let file = fs.readFileSync("./gradle.properties"); + file = file.toString().split("\n").map(e => e.trim().startsWith("mod_version") ? `${e}-beta-${process.env.GITHUB_SHA.substring(0, 7)}` : e).join("\n"); + fs.writeFileSync("./gradle.properties", file); + const mod_version = file.toString().split("\n").filter(e => e.trim().startsWith("mod_version"))[0].split("=")[1].trim(); + const archives_base_name = file.toString().split("\n").filter(e => e.trim().startsWith("archives_base_name"))[0].split("=")[1].trim(); + return `${archives_base_name}-${mod_version}`; + - name: Grant execute permission for gradlew run: chmod +x gradlew diff --git a/build.gradle b/build.gradle index b922fc900..ad9c3335b 100755 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ */ group 'baritone' -version '1.2.15' +version project.mod_version buildscript { repositories { diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 000000000..ca675d85d --- /dev/null +++ b/gradle.properties @@ -0,0 +1,18 @@ +# +# This file is part of Baritone. +# +# Baritone is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Baritone is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with Baritone. If not, see . +# + +mod_version = 1.2.15 \ No newline at end of file