act 的密钥&&环境变量管理

原生的github actions 密钥管理是很强大的,act 也提供了,只是相对简单一些,支持基于环境变量以及文件模式

约定

  • act -s MY_SECRET=key 使用 key 替换
  • act -s MY_SECRET 使用环境变量
  • act --secret-file my.secrets 通过加载my.secrets 文件类似.env 文件

参考使用

name: CI
on: push
env:
  APPVERSION: v1.0
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: list dirs
      run: ls -sialh && echo "${{secrets.name}}"
  app:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: list dirs
      run: ls -sialh && echo "${{env.APPVERSION}}"

命令

act -s name=dalong
 
 

参考资料

https://github.com/nektos/act
https://docs.github.com/en/actions/learn-github-actions/environment-variables
https://docs.github.com/en/actions/security-guides/encrypted-secrets

posted on   荣锋亮  阅读(107)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2021-05-15 nunjucks jinja2 启发的nodejs 模板引擎
2021-05-15 使用jinja 模板引擎生成cube.js schema 文件
2019-05-15 处理kubernetes 一些比较难删除的资源

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示