具体问题:
无法在gnupg
主目录中创建所需文件,因此 gpg 无法连接代理。
额外细节:
- 在 的帮助下
gnupg docs
,我生成了一个临时密钥。
- name: gpg key generation - transient
run: >
export GNUPGHOME="$(mktemp -d)"
cat >tempkey <<EOF
%echo Generating a basic OpenPGP key
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
Subkey-Length: 1024
Name-Real: J143 Bot
Name-Comment: this contains some passphrase
Name-Email: j143+[bot]@protonmail.com
Expire-Date: 0
Passphrase: asdfghjkl
# Do a commit here, so that we can later print "done" :-)
%commit
%echo done
EOF
gpg --batch --generate-key tempkey
- 在 github 操作 (CI) 中尝试了此密钥生成,我收到以下错误消息:
gpg: WARNING: unsafe ownership on homedir '/home/runner/gnupg_home'
gpg: failed to create temporary file '/home/runner/gnupg_home/.#lk0x00005632ca729d00.fv-az269-930.1622': Permission denied
gpg: keyblock resource '/home/runner/gnupg_home/pubring.kbx': Permission denied
gpg: Generating a basic OpenPGP key
gpg: failed to create temporary file '/home/runner/gnupg_home/.#lk0x00005632ca732190.fv-az269-930.1622': Permission denied
gpg: can't connect to the agent: Permission denied
gpg: agent_genkey failed: No agent running
gpg: key generation failed: No agent running
gpg: done
- 生成的密钥用于签名
maven-gpg-plugin
,错误信息如下所示:
[INFO] [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-gpg-plugin:1.6:sign' with basic configurator -->
[INFO] [DEBUG] (f) ascDirectory = /home/runner/work/release-scripts/release-scripts/systemds/target/gpg
[INFO] [DEBUG] (f) defaultKeyring = true
[INFO] [DEBUG] (f) homedir = /home/runner/gnupghome
[INFO] [DEBUG] (f) interactive = false
[INFO] [DEBUG] (f) passphraseServerId = gpg.passphrase
[INFO] [DEBUG] (f) project = MavenProject: org.apache.systemds:systemds:2.1.0-SNAPSHOT @ /home/runner/work/release-scripts/release-scripts/systemds/pom.xml
[INFO] [DEBUG] (f) settings = org.apache.maven.execution.SettingsAdapter@596ad7fe
[INFO] [DEBUG] (f) skip = false
[INFO] [DEBUG] (f) useAgent = true
[INFO] [DEBUG] -- end configuration --
[INFO] [DEBUG] Generating signature for /home/runner/work/release-scripts/release-scripts/systemds/target/systemds-2.1.0-SNAPSHOT.jar
完整的工作流程文件在这里:./maven-publish.yml#L43-L98