I have a command I execute on a pipeline :
firebase hosting:channel:deploy --only main --project test-project --config firebase.json test
This command apparently throw out those outputs =>
https://github.com/marketplace/actions/deploy-to-firebase-hosting
urls
The url(s) deployed toexpire_time
The time the deployed preview urls expiredetails_url
A single URL that was deployed to
When I run it it goes basically with
$ 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]
I would like to retrieve that last line, store it in a variable to reuse it in a future step of the pipeline.
I tried to do
- RESULT=$(firebase hosting:channel:deploy --only main --project test-project --config firebase.json test)
- echo "export PREVIEW_LINK=$RESULT" >> set_preview_link.sh
But this put the whole command output.
Is there a way to just get
hosting:channel: Channel URL (test-project): https://test-project--test-xj60axa8.web.app [expires 2022-11-01 12:22:04]
or even just the https://test-project--test-xj60axa8.web.app
2
Answers
tail
is useful for grabbing the last line of output.Getting the URL specifically – depending on the possible outputs you could try to extract the column with something like
awk
orcut
. Regular expressions can also work.If your grep supports the
-P
flag.Check the content of
RESULT