mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-26 19:42:59 +00:00
Add Upload Version json to COS
This commit is contained in:
1 parent
49fb976a2c
commit
e3020dad00
4 files changed
+38
-16
No files matched your search
@@ -25,7 +25,8 @@ jobs:
|
||||
|
||||
# Gradle
|
||||
- run: gradle --version
|
||||
- run: gradle clean build upload
|
||||
- run: gradle clean build
|
||||
- run: gradle upload
|
||||
|
||||
- store_artifacts:
|
||||
path: ./build/libs
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"id": "${mcVersion}-CSL-${modFullVersion}",
|
||||
"id": "${mcVersion}-CSL-${modShortFullVersion}",
|
||||
"inheritsFrom": "${mcVersion}",
|
||||
"jar": "${mcVersion}",
|
||||
"releaseTime": "2013-01-02T21:10:00+08:00",
|
||||
|
||||
+19
-7
@@ -35,22 +35,30 @@ import com.qcloud.cos.auth.COSCredentials
|
||||
import com.qcloud.cos.region.Region
|
||||
import com.qcloud.cos.model.PutObjectRequest
|
||||
|
||||
static String getLibKey(String filename){
|
||||
filename=filename.substring(0,filename.lastIndexOf('.'))
|
||||
static String getLibKey(String filename) {
|
||||
String name = filename.substring(0, filename.lastIndexOf('.'))
|
||||
return String.format(
|
||||
"libraries/customskinloader/%s/%s/%s",
|
||||
filename.substring(0, filename.indexOf('-')),
|
||||
filename.substring(filename.indexOf('-') + 1),
|
||||
name.substring(0, name.indexOf('-')),
|
||||
name.substring(name.indexOf('-') + 1),
|
||||
filename
|
||||
)
|
||||
}
|
||||
|
||||
static void uploadFileToCOS(File file) {
|
||||
static String getVersionKey(String filename) {
|
||||
String name = filename.substring(0, filename.lastIndexOf('.'))
|
||||
return String.format(
|
||||
"versions/%s/%s",
|
||||
name,
|
||||
filename
|
||||
)
|
||||
}
|
||||
|
||||
static void uploadFileToCOS(String key, File file) {
|
||||
COSCredentials cred = new BasicCOSCredentials(System.getenv("COS_SECRET_ID"), System.getenv("COS_SECRET_KEY"))
|
||||
ClientConfig clientConfig = new ClientConfig(new Region("ap-shanghai"))
|
||||
COSClient cosClient = new COSClient(cred, clientConfig)
|
||||
String bucketName = System.getenv("COS_BUCKET")
|
||||
String key = getLibKey(file.getName())
|
||||
|
||||
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key, file)
|
||||
cosClient.putObject(putObjectRequest)
|
||||
@@ -63,7 +71,11 @@ task upload {
|
||||
if (!dir.isDirectory()) return
|
||||
File[] files = dir.listFiles()
|
||||
for (file in files) {
|
||||
uploadFileToCOS(file)
|
||||
String name = file.getName()
|
||||
uploadFileToCOS(
|
||||
name.endsWith("jar") ? getLibKey(name) : getVersionKey(name),
|
||||
file
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-7
@@ -26,6 +26,7 @@ version = rootProject.ext.config.version + rootProject.ext.config.dev_version +
|
||||
(ext.release ? '' : ('-SNAPSHOT-' + System.getenv("CIRCLE_BUILD_NUM")))
|
||||
group = config.group
|
||||
archivesBaseName = rootProject.ext.config.name + "_" + config.minecraft_version
|
||||
ext.shortFullVersion = ((String) project.version).replace("SNAPSHOT", "S");
|
||||
|
||||
sourceCompatibility = targetCompatibility = 1.6
|
||||
compileJava {
|
||||
@@ -70,13 +71,14 @@ sourceSets {
|
||||
|
||||
processResources {
|
||||
expand([
|
||||
modVersion : rootProject.ext.config.version,
|
||||
modFullVersion: project.version,
|
||||
mcVersion : config.minecraft_version,
|
||||
mcFullVersions: config.minecraft_full_versions,
|
||||
forgeVersion : config.forge_version,
|
||||
gitVersion : System.getenv("CIRCLE_SHA1"),
|
||||
buildUrl : System.getenv("CIRCLE_BUILD_URL")
|
||||
modVersion : rootProject.ext.config.version,
|
||||
modFullVersion : project.version,
|
||||
modShortFullVersion: shortFullVersion,
|
||||
mcVersion : config.minecraft_version,
|
||||
mcFullVersions : config.minecraft_full_versions,
|
||||
forgeVersion : config.forge_version,
|
||||
gitVersion : System.getenv("CIRCLE_SHA1"),
|
||||
buildUrl : System.getenv("CIRCLE_BUILD_URL")
|
||||
])
|
||||
}
|
||||
task copyResources << {
|
||||
@@ -108,6 +110,13 @@ task afterBuild {
|
||||
exclude '**/*-dev.jar'
|
||||
exclude '**/*-sources.jar'
|
||||
}
|
||||
|
||||
//copyProfileJson
|
||||
File f = project.file("build/resources/main/Profile.json")
|
||||
String of = String.format("build/libs/%s-CSL-%s.json", config.minecraft_version, shortFullVersion)
|
||||
File off = rootProject.file(of)
|
||||
off.parentFile.mkdirs()
|
||||
f.renameTo(off)
|
||||
}
|
||||
}
|
||||
build.finalizedBy afterBuild
|
||||
|
||||
Reference in new issue
Block a user