-
Notifications
You must be signed in to change notification settings - Fork 880
[release/3.6] 更新 Jenkins CI 服务器的发布模型 #4582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
buildSrc/src/main/java/org/jackhuang/hmcl/gradle/ci/GitHubActionUtils.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| * Hello Minecraft! Launcher | ||
| * Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program 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 General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
| package org.jackhuang.hmcl.gradle.ci; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| /// @author Glavo | ||
| public final class GitHubActionUtils { | ||
| private static final String OFFICIAL_ORGANIZATION = "HMCL-dev"; | ||
|
|
||
| public static final boolean IS_ON_OFFICIAL_REPO = | ||
| OFFICIAL_ORGANIZATION.equalsIgnoreCase(System.getenv("GITHUB_REPOSITORY_OWNER")) | ||
| && Objects.requireNonNullElse(System.getenv("GITHUB_BASE_REF"), "").isBlank(); | ||
|
|
||
| private GitHubActionUtils() { | ||
| } | ||
| } |
27 changes: 27 additions & 0 deletions
27
buildSrc/src/main/java/org/jackhuang/hmcl/gradle/ci/JenkinsUtils.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Hello Minecraft! Launcher | ||
| * Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program 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 General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
| package org.jackhuang.hmcl.gradle.ci; | ||
|
|
||
| /// @author Glavo | ||
| public final class JenkinsUtils { | ||
|
|
||
| public static final boolean IS_ON_CI = "1".equals(System.getenv("HMCL_CI")); | ||
|
|
||
| private JenkinsUtils() { | ||
| } | ||
| } |
39 changes: 39 additions & 0 deletions
39
buildSrc/src/main/java/org/jackhuang/hmcl/gradle/utils/PropertiesUtils.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| * Hello Minecraft! Launcher | ||
| * Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program 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 General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
| package org.jackhuang.hmcl.gradle.utils; | ||
|
|
||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| import java.io.IOException; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
| import java.util.Properties; | ||
|
|
||
| /// @author Glavo | ||
| public final class PropertiesUtils { | ||
| public static @NotNull Properties load(Path path) throws IOException { | ||
| Properties properties = new Properties(); | ||
| try (var reader = Files.newBufferedReader(path)) { | ||
| properties.load(reader); | ||
| } | ||
| return properties; | ||
| } | ||
|
|
||
| private PropertiesUtils() { | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,4 @@ | ||||
| #!/usr/bin/env bash | ||||
|
|
||||
| sed -i 's,//services.gradle.org/distributions/,//mirrors.cloud.tencent.com/gradle/,g' "$PWD/gradle/wrapper/gradle-wrapper.properties" | ||||
|
|
||||
|
||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| pipeline { | ||
| agent any | ||
|
|
||
| environment { | ||
| HMCL_CI = '1' | ||
|
|
||
| VERSION_TYPE = 'dev' | ||
| MICROSOFT_AUTH_ID = credentials('microsoft_auth_id') | ||
| MICROSOFT_AUTH_SECRET = credentials('microsoft_auth_secret') | ||
| CURSEFORGE_API_KEY = credentials('curseforge_api_key') | ||
| HMCL_SIGNATURE_KEY = credentials('hmcl_signature_key') | ||
| } | ||
|
|
||
| stages { | ||
| stage('Build') { | ||
| steps { | ||
| sh 'bash ./config/jenkins/config-jenkins.sh' | ||
| sh './gradlew clean makeExecutables --stacktrace --no-daemon' | ||
| archiveArtifacts artifacts: 'HMCL/build/libs/*' | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| pipeline { | ||
| agent any | ||
|
|
||
| environment { | ||
| HMCL_CI = '1' | ||
|
|
||
| VERSION_TYPE = 'stable' | ||
| MICROSOFT_AUTH_ID = credentials('microsoft_auth_id') | ||
| MICROSOFT_AUTH_SECRET = credentials('microsoft_auth_secret') | ||
| CURSEFORGE_API_KEY = credentials('curseforge_api_key') | ||
| HMCL_SIGNATURE_KEY = credentials('hmcl_signature_key') | ||
| } | ||
|
|
||
| stages { | ||
| stage('Build') { | ||
| steps { | ||
| sh 'bash ./config/jenkins/config-jenkins.sh' | ||
| sh './gradlew clean makeExecutables --stacktrace --no-daemon' | ||
| archiveArtifacts artifacts: 'HMCL/build/libs/*' | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # | ||
| # Hello Minecraft! Launcher | ||
| # Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors | ||
| # | ||
| # This program is free software: you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation, either version 3 of the License, or | ||
| # (at your option) any later version. | ||
| # | ||
| # This program 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 General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| # | ||
| versionRoot=3.6 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The variable
launcherExeis assigned a default empty string but later checked withisBlank()andisNotBlank(). Consider using a nullable type and checking for null instead, or document why empty string is preferred over null.