Connect your GitHub Actions workflow to Humanitec


This how-to guide explains how to connect your GitHub Actions workflow to Humanitec to retrieve your container images from your repositories.

Here is a short video explaining how to connect your GitHub Actions workflow to Humanitec.

The Humanitec GitHub Action

Humanitec is providing a GitHub Action Build and Push to Humanitec which is available in the GitHub Marketplace. Using this GitHub Actions allows for a simple and convenient integration between GitHub and Hunmanitec.

Create a new workflow

If you do not have a GitHub Actions workflow set up, you will need to create one.

  1. Go to the GitHub repository you want to connect.
  2. Click the Actions tab.
  3. Click the Set up a workflow yourself button in the top right corner.
  4. Remove all of the lines after the line that says: - uses: actions/[email protected]. The resulting file should look like this:

# This is a basic workflow to help you get started with Actions.

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
    branches: [ master ]
    branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
  # This workflow contains a single job called "build"
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    - uses: actions/[email protected]

Note that this file is not yet committed to the repository. In the next step, you will add the necessary configurations to connect to Humanitec.

Add Humanitec snippet and token to workflow

  1. Log in to Humanitec.
  2. Click the profile icon in the top right.
  3. Select Organization Settings.
  4. Select the Images tab.
  5. Click the GitHub Actions button.

From there, Humanitec will provide you with an access token for connecting to Humanitec’s registry and a code snippet to add to your workflow configuration in order to push the image. Instructions will appear in the modal.