blob: 08478081d43e8f6d0ac0baff8ba862eff01ced4a [file] [log] [blame]
Mohammed Nasere81021f2024-01-01 22:49:30 -05001name: images
2
3on:
4 pull_request:
5 push:
6 branches:
7 - main
8
Mohammed Naser2deb8542024-01-01 22:50:41 -05009permissions:
10 packages: write
11 contents: read
12
Mohammed Nasere81021f2024-01-01 22:49:30 -050013jobs:
14 build:
15 runs-on: ubuntu-latest
16 steps:
17 - name: Checkout project
renovate[bot]38929d42024-01-02 11:18:18 -050018 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
Mohammed Nasere81021f2024-01-01 22:49:30 -050019
20 - name: Install Earthly
21 uses: earthly/actions-setup@v1
22 with:
23 github-token: ${{ secrets.GITHUB_TOKEN }}
24
25 - name: Configure Earthly
26 run: |
27 mkdir -p ~/.earthly/certs
28 cat << EOF > ~/.earthly/certs/ca_cert.pem
29 ${{ secrets.EARTHLY_CA_CERT }}
30 EOF
31 cat << EOF > ~/.earthly/certs/earthly_cert.pem
32 ${{ secrets.EARTHLY_CERT }}
33 EOF
34 cat << EOF > ~/.earthly/certs/earthly_key.pem
35 ${{ secrets.EARTHLY_CERT_KEY }}
36 EOF
37 cat << EOF > ~/.earthly/config.yml
38 global:
39 buildkit_host: tcp://162.253.55.125:8372
40 EOF
41
42 - name: Login to GitHub Container Registry
renovate[bot]38929d42024-01-02 11:18:18 -050043 uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3
Mohammed Nasere81021f2024-01-01 22:49:30 -050044 with:
45 registry: ghcr.io
46 username: ${{ github.actor }}
47 password: ${{ secrets.GITHUB_TOKEN }}
48
49 - name: Build images
50 run: earthly +images
51 env:
52 EARTHLY_CI: true
53 EARTHLY_PUSH: "${{ github.event_name == 'push' }}"
Mohammed Naser7a848bc2024-01-22 21:58:11 -050054
55 scan:
56 runs-on: ubuntu-latest
57 needs: build
58 steps:
59 - name: Checkout project
60 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
61
62 - name: Install Earthly
63 uses: earthly/actions-setup@v1
64 with:
65 github-token: ${{ secrets.GITHUB_TOKEN }}
66
67 - name: Configure Earthly
68 run: |
69 mkdir -p ~/.earthly/certs
70 cat << EOF > ~/.earthly/certs/ca_cert.pem
71 ${{ secrets.EARTHLY_CA_CERT }}
72 EOF
73 cat << EOF > ~/.earthly/certs/earthly_cert.pem
74 ${{ secrets.EARTHLY_CERT }}
75 EOF
76 cat << EOF > ~/.earthly/certs/earthly_key.pem
77 ${{ secrets.EARTHLY_CERT_KEY }}
78 EOF
79 cat << EOF > ~/.earthly/config.yml
80 global:
81 buildkit_host: tcp://162.253.55.125:8372
82 EOF
83
84 - name: Scan images
85 run: earthly +scan-images
86 env:
87 EARTHLY_CI: true