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.
- Go to the GitHub repository you want to connect.
- Click the Actions tab.
- Click the Set up a workflow yourself button in the top right corner.
- 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 Humanitec.
Add Humanitec snippet and token to workflow
- Log in to Humanitec.
- Click the profile icon in the top right.
- Select Organization Settings.
- Select the Images tab.
- 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.