use `git describe` instead

This commit is contained in:
Wagyourtail 2022-06-03 14:09:37 -06:00
parent caa88c5b60
commit 4dba5a4399
No known key found for this signature in database
GPG Key ID: 919725C5A647667A
2 changed files with 2 additions and 20 deletions

View File

@ -20,29 +20,11 @@ jobs:
java-version: '8' java-version: '8'
distribution: 'adopt' distribution: 'adopt'
- uses: actions/github-script@v2
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 => {
if (!e.trim().startsWith("mod_version")) return e;
if (process.env.GITHUB_REF.includes("tags")) return e;
let vers = e.split(".");
let n = parseInt(vers[vers.length-1].trim()) + 1;
vers = vers.slice(0, vers.length - 1);
vers.push(n);
return `${vers.join(".")}-beta-${process.env.GITHUB_SHA.substring(0, 7)}`;
}).join("\n");
fs.writeFileSync("./gradle.properties", file);
- name: Grant execute permission for gradlew - name: Grant execute permission for gradlew
run: chmod +x gradlew run: chmod +x gradlew
- name: Build with Gradle - name: Build with Gradle
run: ./gradlew build run: ./gradlew build -Pmod_version=$(git describe --always --tags | cut -c2-)
- name: Archive Artifacts - name: Archive Artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2

View File

@ -15,4 +15,4 @@
# along with Baritone. If not, see <https://www.gnu.org/licenses/>. # along with Baritone. If not, see <https://www.gnu.org/licenses/>.
# #
mod_version = 1.2.15 mod_version = 1.2.15-local_build