7
7
tags : [ 'v*.*.*' ]
8
8
pull_request :
9
9
branches : [ "main" ]
10
- env :
11
- # Use docker.io for Docker Hub if empty
12
- REGISTRY : ghcr.io
13
- # github.repository as <account>/<repo>
14
- IMAGE_NAME : ${{ github.repository }}
15
10
16
11
jobs :
17
12
build :
18
13
runs-on : ubuntu-latest
19
14
permissions :
20
15
contents : read
21
16
packages : write
22
- # This is used to complete the identity challenge
23
- # with sigstore/fulcio when running outside of PRs.
24
- id-token : write
25
-
26
17
steps :
27
18
- name : Checkout repository
28
19
uses : actions/checkout@v4
29
20
- uses : earthly/actions-setup@v1
30
21
with :
31
22
github-token : ${{ secrets.GITHUB_TOKEN }}
32
23
version : " latest" # or pin to an specific version, e.g. "0.8.1"
33
- # Login against a Docker registry except on PR
34
- # https://github.com/docker/login-action
35
- - name : Log into registry ${{ env.REGISTRY }}
24
+ - name : Log into registry
36
25
if : github.event_name != 'pull_request'
37
26
uses : docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
38
27
with :
39
- registry : ${{ env.REGISTRY }}
28
+ registry : ghcr.io
40
29
username : ${{ github.actor }}
41
30
password : ${{ secrets.GITHUB_TOKEN }}
42
- # Extract metadata (tags, labels) for Docker
43
- # https://github.com/docker/metadata-action
44
- - name : Extract Docker metadata
45
- id : meta
46
- uses : docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
47
- with :
48
- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
49
- # Build and push Docker image with Buildx (don't push on PR)
50
- # https://github.com/docker/build-push-action
51
31
- name : Build and push Docker image
32
+ if : github.event_name != 'pull_request'
52
33
id : build-and-push
53
34
run : |
54
35
earthly --push +xesite
55
- earthly --push +patreon-saasproxy
36
+ earthly --push +patreon-saasproxy
37
+ - name : Build Docker image
38
+ if : github.event_name == 'pull_request'
39
+ id : build
40
+ run : |
41
+ earthly +xesite
42
+ earthly +patreon-saasproxy
0 commit comments