3

我正在 GITLAB 中设置我的 maven 项目的 CI,我需要在发布到 maven Central 之前对 jar 进行签名。(https://gitlab.com/awe-team/ade

我使用 gnuPgp 生成密钥对并将公钥添加到我的 gitlab 配置文件中。

我是否将我的私钥副本复制到 gitlab-ci 工作文件夹?

得到的错误是找不到密钥。

[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-gpg-plugin:1.5:sign' 
  with basic configurator -->
  [DEBUG]   (f) ascDirectory = /builds/awe-team/ade/target/gpg
  [DEBUG]   (f) defaultKeyring = true
  [DEBUG]   (f) interactive = false
  [DEBUG]   (f) passphrase = *******
  [DEBUG]   (f) skip = false
  [DEBUG]   (f) useAgent = true
  [DEBUG]   (f) project = MavenProject: com.almis.ade:ade:2.0.5 @ /builds/awe- team/ade/pom.xml
  [DEBUG] -- end configuration --
  [DEBUG] Generating signature for /builds/awe-team/ade/target/ade-2.0.5.pom
  gpg: directory '/root/.gnupg' created
  gpg: keybox '/root/.gnupg/pubring.kbx' created
  gpg: no default secret key: No secret key
  gpg: signing failed: No secret key

我的 .gitlab-ci.yaml 看起来行:

image: maven:latest

variables:
 MAVEN_CLI_OPTS: "-X -s .m2/settings.xml --batch-mode - 
 Dgpg.passphrase=$GPG_PASSPHRASE"
 MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"

cache:
  paths:
    - .m2/repository/
    - target/

build:
  stage: build
  script:
    - mvn $MAVEN_CLI_OPTS compile

test:
  stage: test
  script:
    - mvn $MAVEN_CLI_OPTS test

deploy:
  stage: deploy
  script:    
     - mvn $MAVEN_CLI_OPTS deploy
  only:
     - master

我希望构建一个我的 jar 版本并签署它以发布 maven Central。

4

0 回答 0