1

I have a pipeline in GitLab that consists of multiple stages.
Each stage has a few jobs and produces artifacts, that are passed to the next stage if all the jobs from a stage will pass.

Something similar to this screenshot: gitlab pipeline

Is there any way to achieve something similar in GitHub actions?

Djent
  • 2,877
  • 10
  • 41
  • 66
  • Check this link: https://stackoverflow.com/questions/64205410/gitlab-ci-specify-that-job-c-should-run-after-job-b-if-job-a-fails?rq=1 – attin83 Oct 05 '21 at 13:11
  • @attin83 - I already have a GitLab pipeline like that. Now I want to have something similar in GitHub actions. – Djent Oct 05 '21 at 13:21

2 Answers2

1

Generally speaking, you can get very close to what you have above in GitHub actions. You'd trigger a workflow based on push and pull_request events so that it triggers when someone pushes to your repository, then you'd define each of your jobs. You would then use the needs syntax to define dependencies instead of stages (which is similar to the 14.2 needs syntax from GitLab), so for example your auto-deploy job would have needs: [test1, test2].

The one thing you will not be able to replicate is the manual wait on pushing to production. GitHub actions does not have the ability to pause at a job step and wait for a manual action. You can typically work around this by running workflows based on the release event, or by using a manual kick-off of the whole pipeline with a given variable set.

When looking at how to handle artifacts, check out the answer in this other stack overflow question: Github actions share workspace/artifacts between jobs?

Patrick
  • 2,885
  • 1
  • 14
  • 20
1

I know the OP is 2 years old , but you can so far only use environment based manual triggers (approver based security rule) as shown below. github sucks big time just because of this missing feature

ManualApprove:
needs: build
environment:
  name: approvers
runs-on: ubuntu-latest
steps:
- name: manual approve
  run: |
      echo "Manualy approved"

source thread: https://stackoverflow.com/a/73708545/14744336

Note : You also have community G-action that pauses a workflow but will take an issue at each run (equally sucks if you come from Gitlab) trstringer/manual-approval@v1

koss
  • 107
  • 1
  • 7