|
1 | 1 | # https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio |
2 | 2 | name: Create and publish a Docker image |
3 | 3 |
|
| 4 | +permissions: |
| 5 | + id-token: write |
| 6 | + contents: write |
| 7 | + packages: write |
| 8 | + |
4 | 9 | # Configures this workflow to run every time a change is pushed to the branch called `release`. |
5 | 10 | on: |
6 | 11 | push: |
|
59 | 64 | # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. |
60 | 65 | # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. |
61 | 66 | - name: Build and push Docker image |
| 67 | + id: build-push-latest |
62 | 68 | uses: docker/build-push-action@v5 |
63 | 69 | with: |
64 | 70 | context: . |
|
68 | 74 | annotations: ${{ steps.meta.outputs.annotations }} |
69 | 75 | cache-from: type=gha |
70 | 76 | cache-to: type=gha,mode=max |
| 77 | + - name: Attest image |
| 78 | + uses: github-early-access/generate-build-provenance@main |
| 79 | + with: |
| 80 | + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 81 | + subject-digest: ${{ steps.build-push-latest.outputs.digest }} |
71 | 82 | - name: Extract metadata (tags, labels) for dev image |
72 | 83 | id: meta2 |
73 | 84 | uses: docker/metadata-action@v5 |
|
79 | 90 | type=ref,event=branch |
80 | 91 | type=sha,format=long |
81 | 92 | - name: Build and push dev image |
| 93 | + id: build-push-development |
82 | 94 | uses: docker/build-push-action@v5 |
83 | 95 | with: |
84 | 96 | context: . |
|
87 | 99 | tags: ${{ steps.meta2.outputs.tags }} |
88 | 100 | labels: ${{ steps.meta2.outputs.labels }} |
89 | 101 | annotations: ${{ steps.meta2.outputs.annotations }} |
90 | | - |
91 | 102 | cache-from: type=gha |
92 | 103 | cache-to: type=gha,mode=max |
| 104 | + - name: Attest dev image |
| 105 | + uses: github-early-access/generate-build-provenance@main |
| 106 | + with: |
| 107 | + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-development |
| 108 | + subject-digest: ${{ steps.build-push-development.outputs.digest }} |
0 commit comments