-
I’ve this workflow:
Now, I would like to create another workflow (deploy.yml) to deploy my application on Netlify. How can specify that this deploy depends of the successfully run of “testing” job ? “testing” and “deploy” are in different workflows files.
Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 15 comments 2 replies
-
You cant. What you can do is to use the same workflow file and then use conditions to trigger or not a specific job. If you want to run a job only when there is a push to master branch you can do it like this:
Another option for deployments is to create a tag when you are ready to deploy and then having a seperate workflow that is listening to the push tag event and trigger your deploy. |
Beta Was this translation helpful? Give feedback.
-
Will this be a feature that will be added in the future? |
Beta Was this translation helpful? Give feedback.
-
I think it should be supported! |
Beta Was this translation helpful? Give feedback.
-
I would love to have such a feature. Perhaps it is simple (for GitHub) to implement, by adding another “on” event trigger?
or
Seems like a must have for “test then deploy” flow, where it makes sense to separate the two workflows instead of toying around with conditions and have everything as one pile of YAML mess. |
Beta Was this translation helpful? Give feedback.
-
This solution would cause a problem if you are using matrix. It will run for every matrix item basically. This really needs to be solved. I can’t believe this doesn’t work! It’s a pretty common requirement.
2. I also want to deploy only on master, but only if all tests pass. Right now this is basically impossible. |
Beta Was this translation helpful? Give feedback.
-
When will this be supported? |
Beta Was this translation helpful? Give feedback.
-
I have try this code,
but it does not work , and show me
|
Beta Was this translation helpful? Give feedback.
-
Same here, I’m facing the same problem. On every master push I need to test different JDK versions and then I publish a package snapshot, but i don’t know how to solve it. |
Beta Was this translation helpful? Give feedback.
-
Instead of creating a new workflow, you might just create a dependent job. See the documentation for |
Beta Was this translation helpful? Give feedback.
-
Yes, you can put it all into different jobs in one workflow, but breaking up your large files into logically separated smaller files is a pretty universal programming best practice, and that’s extra true when you have a lot of different things branching off from one spot (like your tests passing or whatever). If they want to define a workflow as all of those branches together, that’s fine, but that means we need to be able to split out jobs into different files. Otherwise, we’re forced to either write code in some scripting language that builds into the yaml code for our workflow or create some sort of funky trigger event, both of which are incredibly hacky. |
Beta Was this translation helpful? Give feedback.
-
This is possible using the GitHub Workflow runs API. Assuming |
Beta Was this translation helpful? Give feedback.
-
I am also interested in this as well. Workflow depencencies is a must to allow engineers breakdown their pipelines logically in separate files instead of having to maintain huge files. |
Beta Was this translation helpful? Give feedback.
-
could be possible with Ref.: Events that trigger workflows - GitHub Docs
I have a workflow triggered as follows: name: Production deploy on: workflow_run: workflows: ["Stage deploy"] types: - completed |
Beta Was this translation helpful? Give feedback.
-
Surprised this isn’t supported. It would be nice to have multiple workflows nicely separated (one for builds, one for tests, one for deployments) and have some depend on others. It’s possible now using all jobs in a single workflow but its a little messier imo. |
Beta Was this translation helpful? Give feedback.
-
Hmmm… so. |
Beta Was this translation helpful? Give feedback.
You cant.
What you can do is to use the same workflow file and then use conditions to trigger or not a specific job.
If you want to run a job only when there is a push to master branch you can do it like this:
Another option for deployments is to create a tag when you are ready to deploy and then having a seperate workflow that is listening to the push tag event and trigger your deploy.