99
1010env :
1111 REGISTRY : docker.io
12- IMAGE_NAME : johnlin/bpfshoot
1312
1413jobs :
1514 build :
2019 id-token : write
2120 attestations : write
2221
22+ strategy :
23+ matrix :
24+ include :
25+ - dockerfile : Dockerfile
26+ image_name : johnlin/bpfshoot
27+ image_suffix : " "
28+ - dockerfile : Dockerfile.bcc
29+ image_name : johnlin/bpfshoot
30+ image_suffix : " -bcc"
31+
2332 steps :
2433 - name : Checkout repository
2534 uses : actions/checkout@v4
@@ -39,32 +48,32 @@ jobs:
3948 id : meta
4049 uses : docker/metadata-action@v5
4150 with :
42- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
51+ images : ${{ env.REGISTRY }}/${{ matrix.image_name }}
4352 tags : |
44- type=ref,event=branch
45- type=ref,event=pr
46- type=semver,pattern={{version}}
47- type=semver,pattern={{major}}.{{minor}}
48- type=sha,prefix=sha-,format=short
49- type=raw,value=latest,enable={{is_default_branch}}
53+ type=ref,event=branch,suffix=${{ matrix.image_suffix }}
54+ type=ref,event=pr,suffix=${{ matrix.image_suffix }}
55+ type=semver,pattern={{version}},suffix=${{ matrix.image_suffix }}
56+ type=semver,pattern={{major}}.{{minor}},suffix=${{ matrix.image_suffix }}
57+ type=sha,prefix=sha-,format=short,suffix=${{ matrix.image_suffix }}
58+ type=raw,value=latest${{ matrix.image_suffix }} ,enable={{is_default_branch}}
5059
5160 - name : Build and push Docker image
5261 id : build
5362 uses : docker/build-push-action@v5
5463 with :
5564 context : .
56- file : ./Dockerfile
65+ file : ./${{ matrix.dockerfile }}
5766 platforms : linux/amd64,linux/arm64
5867 push : ${{ github.event_name != 'pull_request' }}
5968 tags : ${{ steps.meta.outputs.tags }}
6069 labels : ${{ steps.meta.outputs.labels }}
61- cache-from : type=gha
62- cache-to : type=gha,mode=max
70+ cache-from : type=gha,scope=${{ matrix.dockerfile }}
71+ cache-to : type=gha,mode=max,scope=${{ matrix.dockerfile }}
6372
6473 - name : Generate artifact attestation
6574 if : github.event_name != 'pull_request'
6675 uses : actions/attest-build-provenance@v1
6776 with :
68- subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
77+ subject-name : ${{ env.REGISTRY }}/${{ matrix.image_name }}
6978 subject-digest : ${{ steps.build.outputs.digest }}
7079 push-to-registry : true
0 commit comments