重复使用 Fastlane 匹配来加密其他凭据和 android 密钥存储



我正在使用 Fastlane match 来管理我的 iOS 代码签名。

有没有办法使用相同的存储库来存储应用程序中使用但无法在 Git 中检查的其他项目凭据 [密钥、API 令牌等],或者使用 Fastlane 匹配命令创建新的加密存储库?

下面的代码执行,但存储库 out.txt 中的文件未加密。

当前代码:

desc "Encrypt git"
lane :encrypt do  
UI.success "Encrypting git!"
storage = Match::Storage.for_mode("git", { git_url: git_url, shallow_clone: shallow_clone, git_branch: branch, clone_branch_directly: true})  
storage.download
encryption = Match::Encryption.for_storage_mode("git", { git_url: git_url, working_directory: storage.working_directory})
encryption.decrypt_files
file = "#{storage.working_directory}/out.txt"
out_file = File.new("#{file}", "w")
out_file.puts("version:#{Time.now.to_i}")
out_file.close 
encryption.encrypt_files
files_to_commit = Dir[File.join(storage.working_directory, "**", "*.{txt}")]
encryption.encrypt_files
storage.save_changes!(files_to_commit: files_to_commit)
end 
end

输出:

Successfully loaded Appfile at path '/Users/xx/Workspace/yy/ci/zz/fastlane/Appfile'
-------
Successfully loaded Appfile at path '/Users/xx/Workspace/yy/ci/zz/fastlane/Appfile'
-------
WARN [2019-05-31 03:15:16.70]: You have required a gem, if this is a third party gem, please use `fastlane_require 'match'` to ensure the gem is installed locally.
INFO [2019-05-31 03:15:17.00]: ------------------------------
INFO [2019-05-31 03:15:17.00]: --- Step: default_platform ---
INFO [2019-05-31 03:15:17.00]: ------------------------------
INFO [2019-05-31 03:15:17.01]: Driving the lane 'mac test'   
INFO [2019-05-31 03:15:17.01]: Encrypting git!
INFO [2019-05-31 03:15:17.01]: Cloning remote git repo...
INFO [2019-05-31 03:15:17.01]: $ git clone ./../gitrepo/.git /var/folders/7s/s7248n8j0yz0lth821hx4bdm0000gp/T/d20190531-95641-60lael -b master --single-branch
INFO [2019-05-31 03:15:17.02]: ▸ Cloning into '/var/folders/7s/s7248n8j0yz0lth821hx4bdm0000gp/T/d20190531-95641-60lael'...
INFO [2019-05-31 03:15:17.13]: ▸ done.
INFO [2019-05-31 03:15:17.15]:     Successfully decrypted certificates repo
INFO [2019-05-31 03:15:17.15]:     Successfully encrypted certificates repo
INFO [2019-05-31 03:15:17.15]: Pushing changes to remote git repo...
INFO [2019-05-31 03:15:17.15]: $ git add /var/folders/7s/s7248n8j0yz0lth821hx4bdm0000gp/T/d20190531-95641-60lael/match_version.txt
INFO [2019-05-31 03:15:17.17]: $ git add /var/folders/7s/s7248n8j0yz0lth821hx4bdm0000gp/T/d20190531-95641-60lael/out.txt
INFO [2019-05-31 03:15:17.19]: $ git commit -m [fastlane] Updated  and platform 
INFO [2019-05-31 03:15:17.24]: ▸ [master 6bdc078] [fastlane] Updated  and platform
INFO [2019-05-31 03:15:17.25]: ▸ 1 file changed, 1 insertion(+), 1 deletion(-)
INFO [2019-05-31 03:15:17.25]: $ git push origin master
INFO [2019-05-31 03:15:17.31]: ▸ Enumerating objects: 5, done.
INFO [2019-05-31 03:15:17.31]: ▸ Counting objects: 100% (5/5), done.
INFO [2019-05-31 03:15:17.31]: ▸ Delta compression using up to 8 threads.
INFO [2019-05-31 03:15:17.31]: ▸ Compressing objects: 100% (2/2), done.
INFO [2019-05-31 03:15:17.32]: ▸ Writing objects: 100% (3/3), 289 bytes | 144.00 KiB/s, done.
INFO [2019-05-31 03:15:17.32]: ▸ Total 3 (delta 1), reused 0 (delta 0)
INFO [2019-05-31 03:15:17.37]: ▸ To /Users/xx/Workspace/yy/ci/zz/fastlane/./../gitrepo/.git
INFO [2019-05-31 03:15:17.37]: ▸ cac225c..6bdc078  master -> master
INFO [2019-05-31 03:15:17.37]: Finished uploading files to Git Repo [./../gitrepo/.git]
INFO [2019-05-31 03:15:17.44]: Successfully generated documentation at path '/Users/xx/Workspace/yy/ci/zz/fastlane/README.md'
+------+------------------+-------------+
|           fastlane summary            |
+------+------------------+-------------+
| Step | Action           | Time (in s) |
+------+------------------+-------------+
| 1    | default_platform | 0           |
+------+------------------+-------------+
INFO [2019-05-31 03:15:17.45]: fastlane.tools finished successfully   

https://docs.fastlane.tools/advanced/other/#manually-manage-the-fastlane-match-repo(单击Instructions查看实际内容)提供了有关如何手动解密和加密匹配存储库中的数据的建议。

这可能有助于将各种数据放入其中。由于代码只是普通的红宝石,您当然也可以将其包含在您编写的任何脚本或程序中以自动化该过程(而不是像说明中那样在irb中手动完成。

相关内容

  • 没有找到相关文章

最新更新