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 2022-05-15 22:40  荣锋亮  阅读(56)  评论(0编辑  收藏  举报

导航