我注意到切换到 beta channel (Flutter 2.9.0-0.1.pre)后,~/.pub-cache/credentials.json
不再存在。我正在使用这个文件来设置 CI 作业来部署我的 Flutter 包。去哪儿了?
最佳答案
看起来它已移至以下位置:
On Linux:
- If $XDG_CONFIG_HOME is defined:
- $XDG_CONFIG_HOME/dart/pub-credentials.json
- else
- $HOME/.config/dart/pub-credentials.json
On Mac OS:
- ~/Library/Application Support/dart/pub-credentials.json
On Windows:
- %APPDATA%/dart/pub-credentials.json
(来源:dart-lang/pub#2999 - Do not store credentials in PUB_CACHE)
(相关代码:https://github.com/dart-lang/cli_util/blob/master/lib/cli_util.dart#L88)
在 GitHub Actions 上,$XDG_CONFIG_HOME
已定义,因此我执行以下操作:
- name: Prepare pub credentials
run: echo '${{ secrets.PUB_CREDENTIALS }}' > "$XDG_CONFIG_HOME/dart/pub-credentials.json"
关于flutter - dart/flutter pub 的 credentials.json 的新位置是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70487479/