travis-ci - 如何对由 Travis-CI 构建的文件进行 GPG 签名

标签 travis-ci gpg-signature

我看到 Travis 有一个加密文件的工作流程,here .

我的用例稍微简单一些,我只想为在 Travis-CI 上构建的文件生成签名。
说:

hello-0.0.1-a.bin.asc
hello-0.0.1-a.bin
pubkey.gpg 
<or> hello-0.0.1-a.pub

在这种情况下 hello-0.0.1-a.bin由 Travis 构建创建,并将作为发布推送到 Github。
同样,签名也必须作为版本推送到 Github(即在同一标签下)。

如果私钥/公钥对对于该构建是唯一的,我并不十分关心(即不是破坏交易)。
但是,如果在构建之间共享私钥/公钥对,那将是理想的。

欣赏和提示提示或咒语。

最佳答案

它基本上归结为几个步骤。

  • 从您的 gpg key 环中导出 key gpg --export-secret-keys > all.gpg
  • 使用 travis ruby 至encrypt-file gpg key 环(例如 all.gpg )
  • 添加 all.gpg.enc到您的仓库(不是未加密的 all.gpg )
  • 确保 repo 可以访问安全变量
  • 将此行添加到您的 .travis.yml文件以解密您的加密私有(private)签名 key
    openssl aes-256-cbc -K $encrypted_0a6446eb3ae3_key -iv $encrypted_0a6446eb3ae3_key -in all.gpg.enc -out all.gpg -d
  • 导入 gpg key gpg --import all.gpg
  • 为您的图片签名 gpg --output hello.bin.asc --sign hello.bin

  • $ travis encrypt-file all.gpg --add
    encrypting all.gpg for rkh/travis-encrypt-file-example
    storing result as all.gpg.enc
    storing secure env variables for decryption
    
    Make sure to add all.gpg.enc to the git repository.
    Make sure not to add all.gpg to the git repository.
    Commit all changes to your .travis.yml.
    

    关于travis-ci - 如何对由 Travis-CI 构建的文件进行 GPG 签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45188811/

    相关文章:

    hex - Elixir mix 自动确认

    c++ - Travis CI 找不到头文件

    github - 如何使用 GitHub 上的提交电子邮件地址验证 GPG key ?

    Git 提交失败 : Couldn't load public key

    python - 使用 TravisCI 在 Anaconda 上部署 Python 包

    android - Travis 模拟器在 android-wait-for-emulator 之后停止

    bash - 有条件地运行脚本在 travis.yml 中不起作用,为什么?

    android-studio - Android Studio gradle bintray 上传失败 : Could not sign version

    github - Visual Studio Code 1.28.2 和 GitHub 使用受密码保护的 GPG key 签名提交