From 901c331817f74abe8b53b00f6fd92765bb943c12 Mon Sep 17 00:00:00 2001 From: Gugle Date: Sat, 13 Apr 2024 05:45:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9E=84=E5=BB=BA=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 4 ++-- .github/workflows/pull_request.yml | 4 ++-- .github/workflows/release.yml | 2 ++ build.gradle | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2762932b0..27434036e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,8 @@ on: jobs: build: runs-on: ubuntu-latest + env: + CI_BUILD: true steps: - name: checkout uses: actions/checkout@v3.1.0 @@ -33,8 +35,6 @@ jobs: - name: Build uses: gradle/gradle-build-action@v2.4.2 - env: - RUN_NUMBER: ${{ vars.GITHUB_RUN_NUMBER }} with: arguments: build diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index d49e8a50f..ccd6fe01d 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -12,6 +12,8 @@ on: jobs: build: runs-on: ubuntu-latest + env: + CI_BUILD: true steps: - name: checkout uses: actions/checkout@v3.1.0 @@ -31,8 +33,6 @@ jobs: - name: Build uses: gradle/gradle-build-action@v2.4.2 - env: - RUN_NUMBER: ${{ vars.GITHUB_RUN_NUMBER }} with: arguments: build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8fb8fa901..55a9dea57 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,6 +6,8 @@ on: jobs: build: permissions: write-all + env: + CI_BUILD: false runs-on: ubuntu-latest steps: - name: checkout diff --git a/build.gradle b/build.gradle index 057617479..fad3d66b6 100644 --- a/build.gradle +++ b/build.gradle @@ -94,7 +94,9 @@ allprojects { group = rootProject.maven_group // Formats the mod version to include the loader, Minecraft version, and build number (if present) - String buildNumber = System.getenv("RUN_NUMBER") + String buildNumber + if (System.getenv("CI_BUILD") == 'false') buildNumber = null + else buildNumber = System.getenv("GITHUB_RUN_NUMBER") version = "${mod_version}" + (buildNumber != null ? "-build.${buildNumber}" : "") repositories {