GitHub Actions
Here is an example a GitHub Actions build, where we build the Earthly target +build.
1
# .github/workflows/ci.yml
2
​
3
name: CI
4
​
5
on:
6
push:
7
branches: [ main ]
8
pull_request:
9
branches: [ main ]
10
​
11
jobs:
12
build:
13
runs-on: ubuntu-latest
14
env:
15
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
16
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
17
FORCE_COLOR: 1
18
steps:
19
- uses: actions/[email protected]
20
- name: Put back the git branch into git (Earthly uses it for tagging)
21
run: |
22
branch=""
23
if [ -n "$GITHUB_HEAD_REF" ]; then
24
branch="$GITHUB_HEAD_REF"
25
else
26
branch="${GITHUB_REF##*/}"
27
fi
28
git checkout -b "$branch" || true
29
- name: Docker Login
30
run: docker login --username "$DOCKERHUB_USERNAME" --password "$DOCKERHUB_TOKEN"
31
- name: Download latest earthly
32
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download//earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
33
- name: Earthly version
34
run: earthly --version
35
- name: Run build
36
run: earthly --ci --push +build
Copied!
For a complete guide on CI integration see the CI integration guide.
Last modified 2d ago
Copy link