GitHub Actions

News

It is recommended to use Satellites as GHA runners, since they don't require GitHub Actions workers.

Here is an example of a GitHub Actions build that uses the earthly/actions-setup.

This example assumes an Earthfile exists with a +build target:

# .github/workflows/ci.yml

name: Earthly +build

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
      DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
      FORCE_COLOR: 1
    steps:
    - uses: earthly/actions-setup@v1
      with:
        version: v0.8.0
    - uses: actions/checkout@v4
    - name: Docker Login
      run: docker login --username "$DOCKERHUB_USERNAME" --password "$DOCKERHUB_TOKEN"
    - name: Run build
      run: earthly --ci --push +build

Alternatively, you can skip using the earthly/actions-setup job and include a step to download earthly instead:

For a complete guide on CI integration see the CI integration guide.

actions/checkout ref argument

Last updated

Was this helpful?