Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
eab6e5a3
Commit
eab6e5a3
authored
7 years ago
by
ligi
Committed by
Felix Lange
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build: specify the key to use when invoking gpg:sign-and-deploy-file (#16696)
parent
c4a4613d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
8 deletions
+25
-8
ci.go
build/ci.go
+13
-8
pgp.go
internal/build/pgp.go
+12
-0
No files found.
build/ci.go
View file @
eab6e5a3
...
...
@@ -755,14 +755,18 @@ func doAndroidArchive(cmdline []string) {
os
.
Rename
(
archive
,
meta
.
Package
+
".aar"
)
if
*
signer
!=
""
&&
*
deploy
!=
""
{
// Import the signing key into the local GPG instance
if
b64key
:=
os
.
Getenv
(
*
signer
);
b64key
!=
""
{
key
,
err
:=
base64
.
StdEncoding
.
DecodeString
(
b64key
)
if
err
!=
nil
{
log
.
Fatalf
(
"invalid base64 %s"
,
*
signer
)
}
gpg
:=
exec
.
Command
(
"gpg"
,
"--import"
)
gpg
.
Stdin
=
bytes
.
NewReader
(
key
)
build
.
MustRun
(
gpg
)
b64key
:=
os
.
Getenv
(
*
signer
)
key
,
err
:=
base64
.
StdEncoding
.
DecodeString
(
b64key
)
if
err
!=
nil
{
log
.
Fatalf
(
"invalid base64 %s"
,
*
signer
)
}
gpg
:=
exec
.
Command
(
"gpg"
,
"--import"
)
gpg
.
Stdin
=
bytes
.
NewReader
(
key
)
build
.
MustRun
(
gpg
)
keyID
,
err
:=
build
.
PGPKeyID
(
string
(
key
))
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
// Upload the artifacts to Sonatype and/or Maven Central
repo
:=
*
deploy
+
"/service/local/staging/deploy/maven2"
...
...
@@ -771,6 +775,7 @@ func doAndroidArchive(cmdline []string) {
}
build
.
MustRunCommand
(
"mvn"
,
"gpg:sign-and-deploy-file"
,
"-e"
,
"-X"
,
"-settings=build/mvn.settings"
,
"-Durl="
+
repo
,
"-DrepositoryId=ossrh"
,
"-Dgpg.keyname="
+
keyID
,
"-DpomFile="
+
meta
.
Package
+
".pom"
,
"-Dfile="
+
meta
.
Package
+
".aar"
)
}
}
...
...
This diff is collapsed.
Click to expand it.
internal/build/pgp.go
View file @
eab6e5a3
...
...
@@ -57,3 +57,15 @@ func PGPSignFile(input string, output string, pgpkey string) error {
// Generate the signature and return
return
openpgp
.
ArmoredDetachSign
(
out
,
keys
[
0
],
in
,
nil
)
}
// PGPKeyID parses an armored key and returns the key ID.
func
PGPKeyID
(
pgpkey
string
)
(
string
,
error
)
{
keys
,
err
:=
openpgp
.
ReadArmoredKeyRing
(
bytes
.
NewBufferString
(
pgpkey
))
if
err
!=
nil
{
return
""
,
err
}
if
len
(
keys
)
!=
1
{
return
""
,
fmt
.
Errorf
(
"key count mismatch: have %d, want %d"
,
len
(
keys
),
1
)
}
return
keys
[
0
]
.
PrimaryKey
.
KeyIdString
(),
nil
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment