Mohammed Naser | e81021f | 2024-01-01 22:49:30 -0500 | [diff] [blame] | 1 | name: images |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
| 5 | push: |
| 6 | branches: |
| 7 | - main |
| 8 | |
Mohammed Naser | 2deb854 | 2024-01-01 22:50:41 -0500 | [diff] [blame] | 9 | permissions: |
| 10 | packages: write |
| 11 | contents: read |
| 12 | |
Mohammed Naser | e81021f | 2024-01-01 22:49:30 -0500 | [diff] [blame] | 13 | jobs: |
| 14 | build: |
| 15 | runs-on: ubuntu-latest |
| 16 | steps: |
| 17 | - name: Checkout project |
renovate[bot] | 38929d4 | 2024-01-02 11:18:18 -0500 | [diff] [blame] | 18 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
Mohammed Naser | e81021f | 2024-01-01 22:49:30 -0500 | [diff] [blame] | 19 | |
| 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] | 38929d4 | 2024-01-02 11:18:18 -0500 | [diff] [blame] | 43 | uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3 |
Mohammed Naser | e81021f | 2024-01-01 22:49:30 -0500 | [diff] [blame] | 44 | 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 Naser | 7a848bc | 2024-01-22 21:58:11 -0500 | [diff] [blame] | 54 | |
| 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 |