-
Notifications
You must be signed in to change notification settings - Fork 29
46 lines (35 loc) · 1.35 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Build
on: [push, pull_request]
jobs:
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: earthly/actions-setup@v1
with:
version: v0.8.0
- name: Login to GitHub Container Registry
if: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- if: ${{ github.ref == format('refs/heads/{0}', 'master') }}
run: echo "IMAGE_LABEL=latest" >> $GITHUB_ENV
- if: ${{ github.ref == format('refs/heads/{0}', 'dev') }}
run: echo "IMAGE_LABEL=nightly" >> $GITHUB_ENV
- if: ${{ env.IMAGE_LABEL == '' }}
run: echo "IMAGE_LABEL=$BRANCH_NAME" >> $GITHUB_ENV
- run: echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV
- name: Build
run: earthly --ci --push +build-all --COMMIT_SHA=$SHORT_SHA --LABEL=$IMAGE_LABEL