@@ -39,76 +39,20 @@ jobs:
3939 with :
4040 files : pie.phar
4141
42- docker-binary-only-image :
43- needs : build-phar
44- name : Docker binary-only image
45- runs-on : ubuntu-latest
42+ build-and-push-docker-image :
4643 if : ${{ startsWith(github.ref, 'refs/tags/') }}
47-
44+ needs : build-phar
45+ # See build-and-push-docker-image.yml for a list of the permissions and why they are needed
4846 permissions :
49- # attestations:write is required for build provenance attestation.
50- attestations : write
51- # id-token:write is required for build provenance attestation.
47+ contents : read
5248 id-token : write
53- # packages:write is required to publish Docker images to GitHub's registry.
49+ attestations : write
5450 packages : write
55-
56- steps :
57- - name : Checkout repository
58- uses : actions/checkout@v5
59-
60- - name : Fetch built PHAR from artifacts
61- uses : actions/download-artifact@v5
62- with :
63- name : pie-${{ github.sha }}.phar
64-
65- - name : Verify the PHAR
66- env :
67- GH_TOKEN : ${{ github.token }}
68- run : gh attestation verify pie.phar --repo ${{ github.repository }}
69-
70- - name : Set up QEMU
71- uses : docker/setup-qemu-action@v3
72-
73- - name : Set up Docker Buildx
74- uses : docker/setup-buildx-action@v3
75-
76- - name : Log in to the Container registry
77- uses : docker/login-action@v3
78- with :
79- registry : ghcr.io
80- username : ${{ github.actor }}
81- password : ${{ secrets.GITHUB_TOKEN }}
82-
83- - name : Extract metadata (tags, labels) for Docker
84- id : meta
85- uses : docker/metadata-action@v5
86- with :
87- flavor : |
88- latest=false
89- images : ghcr.io/${{ github.repository }}
90- # @TODO v1.0 Consider introducing more granular tags (major and major.minor)
91- # @see https://github.com/php/pie/pull/122#pullrequestreview-2477496308
92- # @see https://github.com/php/pie/pull/122#discussion_r1867331273
93- tags : |
94- type=raw,value=bin
95- type=semver,pattern={{version}}-bin
96-
97- - name : Build and push Docker image
98- id : build-and-push
99- uses : docker/build-push-action@v6
100- with :
101- context : .
102- platforms : linux/amd64,linux/arm64
103- file : Dockerfile
104- target : standalone-binary
105- push : true
106- tags : ${{ steps.meta.outputs.tags }}
107- labels : ${{ steps.meta.outputs.labels }}
108-
109- - name : Generate artifact attestation
110- uses : actions/attest-build-provenance@v3
111- with :
112- subject-name : ghcr.io/${{ github.repository }}
113- subject-digest : ${{ steps.build-and-push.outputs.digest }}
114- push-to-registry : true
51+ uses : ./.github/workflows/build-and-push-docker-image.yml
52+ with :
53+ # @TODO v1.0 Consider introducing more granular tags (major and major.minor)
54+ # @see https://github.com/php/pie/pull/122#pullrequestreview-2477496308
55+ # @see https://github.com/php/pie/pull/122#discussion_r1867331273
56+ tags : |
57+ ${{ ((!contains(github.ref, 'alpha') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc')) && 'type=raw,value=bin') || '' }}
58+ type=semver,pattern={{version}}-bin
0 commit comments