From a4fcf1e7a73fdb0c5d328126e762f83fdd7c7197 Mon Sep 17 00:00:00 2001 From: HSGamer Date: Sat, 24 Feb 2024 18:24:01 +0700 Subject: [PATCH] make a file to store the game version --- .github/workflows/gradle-release.yml | 6 +++++- build.gradle | 7 ++++++- version | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 version diff --git a/.github/workflows/gradle-release.yml b/.github/workflows/gradle-release.yml index d011dff..a50c274 100644 --- a/.github/workflows/gradle-release.yml +++ b/.github/workflows/gradle-release.yml @@ -20,6 +20,10 @@ jobs: uses: metcalfc/changelog-generator@v4.3.0 with: myToken: ${{ secrets.GITHUB_TOKEN }} + - name: Read version + id: version + run: | + echo "::set-output name=version::$(cat version | head -n 1)" - name: Set up JDK 17 uses: actions/setup-java@v4 @@ -37,7 +41,7 @@ jobs: files: build/libs/MoreFoWorld-*.jar env: DESCRIPTION: ${{ steps.changelog.outputs.changelog }} - GAME_VERSIONS: "1.20.4" + GAME_VERSIONS: ${{ steps.version.outputs.version }} GITHUB_TOKEN: ${{ github.token }} diff --git a/build.gradle b/build.gradle index a5c8244..3205947 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,12 @@ repositories { } dependencies { - paperweight.foliaDevBundle("1.20.4-R0.1-SNAPSHOT") + def versionFile = file("version") + if (!versionFile.exists()) { + throw new GradleException("version file not found") + } + def version = versionFile.text.trim() + paperweight.foliaDevBundle("$version-R0.1-SNAPSHOT") def core = "4.3.21" implementation "me.hsgamer:hscore-bukkit-baseplugin:$core" diff --git a/version b/version new file mode 100644 index 0000000..1b9335f --- /dev/null +++ b/version @@ -0,0 +1 @@ +1.20.4 \ No newline at end of file