Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

github actions share values between workflows

I have two workflows within the same project in gihub. The first workflow create and publishes a docker image on docker hub and is automatic on push. The second workflow which is manual should pull the docker image published in workflow 1 and deploy it on a cluster. As part of the first workflow I need to share a docker image tag from workflow 1 to workflow 2. How do I do that. I checked environment variables, but from what I have seen its localized to a workflow and you cannot share it between workflows.

like image 716
tmp dev Avatar asked Jul 04 '26 20:07

tmp dev


1 Answers

You can make use of a reusable workflow using the workflow_call trigger and pass it the tag as an input

docs for reusable workflow: https://docs.github.com/en/actions/using-workflows/reusing-workflows.

If these workflows run at different times, you can store the tag string as an artifact and then reference it later.

docs for artifact: https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts

like image 66
Nicholas Bergesen Avatar answered Jul 08 '26 10:07

Nicholas Bergesen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!