Note: GitHub Actions was available for GitHub Enterprise Server 2.22 as a limited beta. The beta has ended. GitHub Actions is now generally available in GitHub Enterprise Server 3.0 or later. For more information, see the GitHub Enterprise Server 3.0 release notes.
- For more information about upgrading to GitHub Enterprise Server 3.0 or later, see "Upgrading GitHub Enterprise Server."
- For more information about configuring GitHub Actions after you upgrade, see the documentation for GitHub Enterprise Server 3.0.
Note: GitHub-hosted runners are not currently supported on GitHub Enterprise Server. You can see more information about planned future support on the GitHub public roadmap.
Introduction
GitLab CI/CD and GitHub Actions both allow you to create workflows that automatically build, test, publish, release, and deploy code. GitLab CI/CD and GitHub Actions share some similarities in workflow configuration:
- Workflow configuration files are written in YAML and are stored in the code's repository.
- Workflows include one or more jobs.
- Jobs include one or more steps or individual commands.
- Jobs can run on either managed or self-hosted machines.
There are a few differences, and this guide will show you the important differences so that you can migrate your workflow to GitHub Actions.
Jobs
Jobs in GitLab CI/CD are very similar to jobs in GitHub Actions. In both systems, jobs have the following characteristics:
- Jobs contain a series of steps or scripts that run sequentially.
- Jobs can run on separate machines or in separate containers.
- Jobs run in parallel by default, but can be configured to run sequentially.
You can run a script or a shell command in a job. In GitLab CI/CD, script steps are specified using the script
key. In GitHub Actions, all scripts are specified using the run
key.
Below is an example of the syntax for each system:
GitLab CI/CD | GitHub Actions |
---|---|
|
|
Runners
Runners are machines on which the jobs run. Both GitLab CI/CD and GitHub Actions offer managed and self-hosted variants of runners. In GitLab CI/CD, tags
are used to run jobs on different platforms, while in GitHub Actions it is done with the runs-on
key.
Below is an example of the syntax for each system:
GitLab CI/CD | GitHub Actions |
---|---|
|
|
For more information, see "Workflow syntax for GitHub Actions."
Docker images
Both GitLab CI/CD and GitHub Actions support running jobs in a Docker image. In GitLab CI/CD, Docker images are defined with an image
key, while in GitHub Actions it is done with the container
key.
Below is an example of the syntax for each system:
GitLab CI/CD | GitHub Actions |
---|---|
|
|
For more information, see "Workflow syntax for GitHub Actions."
Condition and expression syntax
GitLab CI/CD uses rules
to determine if a job will run for a specific condition. GitHub Actions uses the if
keyword to prevent a job from running unless a condition is met.
Below is an example of the syntax for each system:
GitLab CI/CD | GitHub Actions |
---|---|
|
|
For more information, see "Expressions."
Dependencies between Jobs
Both GitLab CI/CD and GitHub Actions allow you to set dependencies for a job. In both systems, jobs run in parallel by default, but job dependencies in GitHub Actions can be specified explicitly with the needs
key. GitLab CI/CD also has a concept of stages
, where jobs in a stage run concurrently, but the next stage will start when all the jobs in the previous stage have completed. You can recreate this scenario in GitHub Actions with the needs
key.
Below is an example of the syntax for each system. The workflows start with two jobs named build_a
and build_b
running in parallel, and when those jobs complete, another job called test_ab
will run. Finally, when test_ab
completes, the deploy_ab
job will run.
GitLab CI/CD | GitHub Actions |
---|---|
|
|
For more information, see "Workflow syntax for GitHub Actions."
Scheduling workflows
Both GitLab CI/CD and GitHub Actions allow you to run workflows at a specific interval. In GitLab CI/CD, pipeline schedules are configured with the UI, while in GitHub Actions you can trigger a workflow on a scheduled interval with the "on" key.
For more information, see "Events that trigger workflows."
Variables and secrets
GitLab CI/CD and GitHub Actions support setting environment variables in the pipeline or workflow configuration file, and creating secrets using the GitLab or GitHub Enterprise Server UI.
For more information, see "Environment variables" and "Encrypted secrets."
Caching
GitLab CI/CD and GitHub Actions provide a method in the configuration file to manually cache workflow files.
Below is an example of the syntax for each system:
GitLab CI/CD | GitHub Actions |
---|---|
|
|
GitHub Actions caching is only applicable for repositories hosted on GitHub.com. For more information, see "Caching dependencies to speed up workflows."
Artifacts
Both GitLab CI/CD and GitHub Actions can upload files and directories created by a job as artifacts. In GitHub Actions, artifacts can be used to persist data across multiple jobs.
Below is an example of the syntax for each system:
GitLab CI/CD | GitHub Actions |
---|---|
|
|
For more information, see "Storing workflow data as artifacts."
Databases and service containers
Both systems enable you to include additional containers for databases, caching, or other dependencies.
In GitLab CI/CD, a container for the job is specified with the image
key, while GitHub Actions uses the container
key. In both systems, additional service containers are specified with the services
key.
Below is an example of the syntax for each system:
GitLab CI/CD | GitHub Actions |
---|---|
|
|
For more information, see "About service containers."