Here is an example a GitHub Actions build, where we build the Earthly target +build
.
# .github/workflows/ci.ymlname: CIon:push:branches: [ main ]pull_request:branches: [ main ]jobs:build:runs-on: ubuntu-latestenv:DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}FORCE_COLOR: 1steps:- uses: actions/[email protected]- name: Put back the git branch into git (Earthly uses it for tagging)run: |branch=""if [ -n "$GITHUB_HEAD_REF" ]; thenbranch="$GITHUB_HEAD_REF"elsebranch="${GITHUB_REF##*/}"figit checkout -b "$branch" || true- name: Docker Loginrun: docker login --username "$DOCKERHUB_USERNAME" --password "$DOCKERHUB_TOKEN"- name: Download latest earthlyrun: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.4.5/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"- name: Earthly versionrun: earthly --version- name: Run buildrun: earthly --push +build
For a complete guide on CI integration see the CI integration guide.