@@ -71,15 +71,15 @@ def gitShortRev() {
71
71
}
72
72
73
73
def setScm (scm ) {
74
- scm. appendNode(' connection' , ' https://github.com/Tencent /Shadow.git' )
74
+ scm. appendNode(' connection' , " https://github.com/${ System.getenv("GITHUB_ACTOR") } /Shadow.git" )
75
75
76
76
def commit
77
- if (" ${ System.env.ORANGE } " . equalsIgnoreCase(" true" )) {
78
- commit = " ${ System.env.ORANGE_COMMIT } "
77
+ if (" ${ System.env.CI } " . equalsIgnoreCase(" true" )) {
78
+ commit = System . getenv( " GITHUB_SHA " )
79
79
} else {
80
80
commit = gitShortRev()
81
81
}
82
- scm. appendNode(' url' , " https://github.com/Tencent /Shadow/commit/$commit " )
82
+ scm. appendNode(' url' , " https://github.com/${ System.getenv("GITHUB_ACTOR") } /Shadow/commit/$commit " )
83
83
}
84
84
85
85
def setGeneratePomFileAndDepends (publicationName ) {
@@ -387,7 +387,40 @@ publishing {
387
387
}
388
388
}
389
389
repositories {
390
- mavenLocal()
390
+ def useLocalCredential = false
391
+ Properties properties = new Properties ()
392
+ def propertiesFile = project. rootProject. file(' local.properties' )
393
+ if (propertiesFile. exists()) {
394
+ properties. load(propertiesFile. newDataInputStream())
395
+
396
+ if (" ${ properties.getProperty('gpr.local')} " . equalsIgnoreCase(' true' )) {
397
+ def user = properties. getProperty(' gpr.user' )
398
+ def key = properties. getProperty(' gpr.key' )
399
+ maven {
400
+ name = " GitHubPackages"
401
+ credentials {
402
+ username = user
403
+ password = key
404
+ }
405
+ url " https://maven.pkg.github.com/${ user} /shadow"
406
+ }
407
+
408
+ useLocalCredential = true
409
+ }
410
+ }
411
+
412
+ if (! useLocalCredential && " ${ System.env.CI} " . equalsIgnoreCase(" true" )) {
413
+ maven {
414
+ name = " GitHubPackages"
415
+ credentials {
416
+ username = System . getenv(" GITHUB_ACTOR" )
417
+ password = System . getenv(" GITHUB_TOKEN" )
418
+ }
419
+ url " https://maven.pkg.github.com/" + " ${ System.env.GITHUB_REPOSITORY} " . toLowerCase()
420
+ }
421
+ } else {
422
+ mavenLocal()
423
+ }
391
424
}
392
425
}
393
426
0 commit comments