在github操作中使用多行运行命令的输出
我想运行多个运行命令,但也使用每行的输出作为下一行的输入。
这样的东西。
- name: Upload to firebase and increment git tag
if: github.ref == 'refs/heads/master'
run: |
//I want to save these outputs
VERSION_NAME=$(./gradlew -q getVersionName -Pflavour="myapp" | tail -n 1)
LATEST_TAG=$(git tag --list --sort=-version:refname "myapp/v*-snapshot.*" | head -n 1)
CHANGE_LOG=$(bundle exec fastlane changelog tag:$LATEST_TAG)
// Use the above outputs here
./gradlew -PversionCode=$((1000 + $GITHUB_RUN_NUMBER)) -PchangeLog=$CHANGE_LOG assembleRelease appDistributionUploadRelease
bundle exec fastlane increment_git_tag app_name:'myapp' tag_type:'snapshot' version_name:$VERSION_NAME build_number:$((1000 + $GITHUB_RUN_NUMBER))
当我直接从MACOS终端(按线路)直接运行命令时,上述功能可行。但是,当我运行github操作时,它似乎并不能保存输出或在实际的推荐线中保存输出。
I want to run multiple run commands, but also use the output of each line, as an input to next line.
Something like this.
- name: Upload to firebase and increment git tag
if: github.ref == 'refs/heads/master'
run: |
//I want to save these outputs
VERSION_NAME=$(./gradlew -q getVersionName -Pflavour="myapp" | tail -n 1)
LATEST_TAG=$(git tag --list --sort=-version:refname "myapp/v*-snapshot.*" | head -n 1)
CHANGE_LOG=$(bundle exec fastlane changelog tag:$LATEST_TAG)
// Use the above outputs here
./gradlew -PversionCode=$((1000 + $GITHUB_RUN_NUMBER)) -PchangeLog=$CHANGE_LOG assembleRelease appDistributionUploadRelease
bundle exec fastlane increment_git_tag app_name:'myapp' tag_type:'snapshot' version_name:$VERSION_NAME build_number:$((1000 + $GITHUB_RUN_NUMBER))
The above works when I run the commands directly from a macOS terminal(line-by-line). But when I run the GITHUB action, it does not seems to save the output or makeuse of it in the actual referring line(s).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论