Github操作gpg解密会导致错误(gpg:找不到有效的OpenPGP数据。)

时间:2020-06-30 14:20:20

标签: gnupg github-actions

我正在使用Github动作构建Android apk,并且在发布它之前需要使用Android签名键对其进行签名。

为此,我将here与GPG结合使用,将发布密钥加密为base64字符串,并将其用作Github操作中的秘密。

然后,在我的工作流程中,我使用GPG将其解密回密钥文件。

但是,此过程在我的Mac上正常运行,但Github操作失败。

运行此

- name: Decode keystore file
      run: |
        echo "${{ secrets.KEY_STORE }}" > release.keystore.asc
        gpg -d --passphrase "${{ secrets.KEY_STORE_PASSPHRASE }}" --batch release.keystore.asc > signing-key.jks

结果

gpg: directory '/home/runner/.gnupg' created
gpg: keybox '/home/runner/.gnupg/pubring.kbx' created
gpg: no valid OpenPGP data found.
gpg: decrypt_message failed: Unknown system error
##[error]Process completed with exit code 2.

在使用GPG之前运行sudo apt-get install ca-certificates也无济于事,因为它说它已经安装了。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

似乎tapply(1:nrow(dat), dat$m, function(ix) cor(dat$n1[ix], z[ix])) 包含无效的PGP数据或根本没有数据。首先,我将检查release.keystore.asc的内容。您可以将文件作为工件上传,然后下载以检查其内容。通过在解码密钥库文件步骤

之后添加upload-artifact操作步骤来修改工作流程
release.keystore.asc

现在您可以download - name: Decode keystore file run: | echo "${{ secrets.KEY_STORE }}" > release.keystore.asc gpg -d --passphrase "${{ secrets.KEY_STORE_PASSPHRASE }}" --batch release.keystore.asc > signing-key.jks - uses: actions/upload-artifact@v2 if: failure() with: name: release.keystore.asc path: release.keystore.asc 工件(它将被压缩,因此您必须解压缩它)并检查文件是否包含有效的PGP数据(文件应以release.keystore.asc开头并以-----BEGIN PGP MESSAGE-----结尾,并且之间包含有效的加密PGP内容。如果不是,则表明-----END PGP MESSAGE-----机密包含无效数据。