-
Notifications
You must be signed in to change notification settings - Fork 338
/
Copy pathpublishMainSonatypeTestLocal
executable file
·49 lines (36 loc) · 1.3 KB
/
publishMainSonatypeTestLocal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env -S scala-cli shebang
//> using dep "com.lihaoyi::os-lib:0.11.3"
import java.io.File
// expects SONATYPE_USERNAME and SONATYPE_PASSWORD to be set prior to running!
val console = System.console()
if (console == null) {
System.err.println("Could not initialize system console. Exiting.")
System.exit(1)
}
val sonatypeUsername = System.getenv("SONATYPE_USERNAME")
val sonatypePassword = System.getenv("SONATYPE_PASSWORD")
if (sonatypeUsername == null) {
System.err.println(s"Environment variable 'SONATYPE_USERNAME' not set. Exiting.")
System.exit(1)
}
if (sonatypePassword == null) {
System.err.println(s"Environment variable 'SONATYPE_PASSWORD' not set. Exiting.")
System.exit(1)
}
val gpgPassphrase = console.readPassword("Please enter GPG passphrase for signing: ")
val millBinary =
val tryme = List("./millw", "./mill" )
tryme.find( path => new File(path).exists ).getOrElse("mill")
val sonatypePublishCommand = Seq(
millBinary,
"publish",
"--signed=true",
"--release=false"
)
val testPublishLocalCommand = Seq(
millBinary, "test.publishLocal"
)
println("Publishing main library to Sonatype.")
os.call(sonatypePublishCommand, env=Map("PGP_PASSPHRASE" -> new String(gpgPassphrase)))
println("Publishing test library to local ivy repository.")
os.call(testPublishLocalCommand)