-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (47 loc) · 1.62 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
47
48
49
50
51
52
53
54
55
name: Build and publish image to ghcr.io/epics-containers
on:
push:
pull_request:
jobs:
build:
# pull requests are a duplicate of a branch push if within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
permissions:
contents: read
packages: write
strategy:
fail-fast: true
max-parallel: 1 # take advantage of caching
matrix:
target: [developer, runtime]
include:
- os: ubuntu-latest
platforms: linux/amd64
runs-on: ${{ matrix.os }}
env:
TAG: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-${{ matrix.target }}
steps:
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v3
with:
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image
uses: docker/build-push-action@v5
with:
target: ${{ matrix.target }}
tags: ${{ env.TAG }}:${{ github.ref_name }},${{ env.TAG }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
- name: Test image
run: echo 'no tests yet'
- name: Push image
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
uses: docker/build-push-action@v5
with:
tags: ${{ env.TAG }}:${{ github.ref_name }},${{ env.TAG }}:latest
push: true