Connect your GitHub Actions workflow to Humanitec

Overview

This page explains how to connect your GitHub Actions workflow to the Humanitec platform to retrieve your container images from your repositories.

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
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  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
    steps:
    # 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 the Humanitec platform.

Add Humanitec snippet and token to workflow

  1. Log in to the Humanitec platform.
  2. Click the profile icon in the top right.
  3. Select Account Settings.
  4. Click on your organization.
  5. Select the Module Sources tab.
  6. Click the GitHub Actions button.

From there, the platform 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.