From 69d35a69b7ab7441771b0113f230d89dd1f5bab3 Mon Sep 17 00:00:00 2001 From: 33 Date: Fri, 13 Jan 2023 15:22:29 +0800 Subject: [PATCH] Tweak: release build action --- .github/workflows/beta.yml | 2 +- .github/workflows/canary.yml | 2 +- .github/workflows/common.yml | 5 +++++ .github/workflows/pull-request.yml | 2 +- .github/workflows/release.yml | 3 ++- build.properties | 2 -- .../java/customskinloader/gradle/util/VersionUtil.java | 8 ++++++-- 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 76c2698..279e45b 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -7,7 +7,7 @@ on: jobs: build-beta: name: Build Beta - uses: xfl03/MCCustomSkinLoader/.github/workflows/common.yml@14-develop + uses: .github/workflows/common.yml with: type: Beta publish-task: uploadBeta diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index 6dec5d3..3dd3d09 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -7,7 +7,7 @@ on: jobs: build-canary: name: Build Canary - uses: xfl03/MCCustomSkinLoader/.github/workflows/common.yml@15-develop + uses: .github/workflows/common.yml with: type: Canary publish-task: uploadCanary diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 088dc6d..2fa0576 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -8,6 +8,10 @@ on: publish-task: required: false type: string + is-snapshot: + required: false + type: boolean + default: true jobs: build-common: @@ -29,6 +33,7 @@ jobs: name: Build env: KEY_PASS: ${{ secrets.KEY_PASS }} + IS_SNAPSHOT: ${{ inputs.is-snapshot }} run: | export GIT_COMMIT_DESC=$(git log --format=%B -n 1 $GITHUB_SHA) ./gradlew clean build --stacktrace diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index cedc03c..f18ee88 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -12,6 +12,6 @@ on: jobs: build-pull-request: name: Build Pull Request - uses: xfl03/MCCustomSkinLoader/.github/workflows/common.yml@14-develop + uses: .github/workflows/common.yml with: type: PullRequest \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9ee3114..d2a290f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,8 +7,9 @@ on: jobs: build-release: name: Build Release - uses: xfl03/MCCustomSkinLoader/.github/workflows/common.yml@14-develop + uses: .github/workflows/common.yml with: type: Release publish-task: upload + is-snapshot: false secrets: inherit \ No newline at end of file diff --git a/build.properties b/build.properties index 49bc117..2f22a08 100644 --- a/build.properties +++ b/build.properties @@ -2,5 +2,3 @@ name=CustomSkinLoader group=customskinloader version=14.16 dev_version= -#RELEASE: snapshot=0 -snapshot=1 diff --git a/buildSrc/src/main/java/customskinloader/gradle/util/VersionUtil.java b/buildSrc/src/main/java/customskinloader/gradle/util/VersionUtil.java index ac78754..3232058 100644 --- a/buildSrc/src/main/java/customskinloader/gradle/util/VersionUtil.java +++ b/buildSrc/src/main/java/customskinloader/gradle/util/VersionUtil.java @@ -8,8 +8,12 @@ import java.util.stream.Collectors; public class VersionUtil { public static boolean isRelease(Project rootProject) { - String s = ConfigUtil.getConfigString(rootProject, "snapshot"); - return s == null || s.equals("") || s.equals("0"); + String s = System.getenv("IS_SNAPSHOT"); + // When we cannot find environment variable, it means we are in development, so it is not a release + if (s == null) { + return false; + } + return s.equals("0") || s.equals("false"); } public static boolean isSnapshot(Project rootProject) {