我在管道上执行了一个命令:
firebase hosting:channel:deploy --only main --project test-project --config firebase.json test
这个命令显然会抛出那些输出=> https://github.com/marketplace/actions/deploy-to-firebase-hosting
url部署到
expire_time已部署的预览urls过期的时间
details_url部署到
当我运行它时,它基本上是与
$ firebase hosting:channel:deploy --only main --project test-project --config firebase.json test
=== Deploying to 'test-project'...
i deploying hosting
i hosting[test-project]: beginning deploy...
i hosting[test-project]: found 497 files in dist/apps/main
+ hosting[test-project]: file upload complete
i hosting[test-project]: finalizing version...
+ hosting[test-project]: version finalized
i hosting[test-project]: releasing new version...
+ hosting[test-project]: release complete
+ Deploy complete!
Project Console: https://console.firebase.google.com/project/test-project/overview
Hosting URL: https://test-project.web.app
! hosting:channel: Unable to add channel domain to Firebase Auth. Visit the Firebase Console at https://console.firebase.google.com/project/test-project/authentication/providers
! hosting:channel: Unable to sync Firebase Auth state.
+ hosting:channel: Channel URL (test-project): https://test-project--test-xj60axa8.web.app [expires 2022-11-01 12:22:04]我想检索最后一行,将其存储在一个变量中,以便在管道的未来步骤中重用它。
我试着做
- RESULT=$(firebase hosting:channel:deploy --only main --project test-project --config firebase.json test)
- echo "export PREVIEW_LINK=$RESULT" >> set_preview_link.sh但这会使整个命令输出。
有没有办法
hosting:channel: Channel URL (test-project): https://test-project--test-xj60axa8.web.app [expires 2022-11-01 12:22:04]
甚至仅仅是https://test-project--test-xj60axa8.web.app
发布于 2022-10-25 03:48:56
tail对于获取输出的最后一行非常有用。
RESULT=$(firebase hosting:channel:deploy --only main --project test-project --config firebase.json test | tail -1)
echo "$RESULT"具体地获取URL --根据可能的输出,您可以尝试使用类似于awk或cut的内容来提取列。正则表达式也可以工作。
RESULT=$(firebase hosting:channel:deploy --only main --project test-project --config firebase.json test | tail -1)
url_regex='(https:\/\/[[:alnum:].-]+)'
[[ "$RESULT" =~ $url_regex ]] && echo "${BASH_REMATCH[1]}"发布于 2022-10-25 04:24:46
如果您的grep支持-P标志。
RESULT="$(firebase hosting:channel:deploy ... | grep -Po '(?<=Channel URL \(test-project\): )'.*'(?= \[)')"检查RESULT的内容
declare -p RESULThttps://stackoverflow.com/questions/74188845
复制相似问题