docker workflow
This commit is contained in:
parent
0242397085
commit
241a4eccbb
1 changed files with 25 additions and 22 deletions
47
.github/workflows/push.yml
vendored
47
.github/workflows/push.yml
vendored
|
|
@ -2,7 +2,8 @@ name: Create and publish a Docker image
|
|||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
types: [created, published, prereleased]
|
||||
workflow_dispatch: # This allows manual triggering of the workflow
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
|
|
@ -22,39 +23,41 @@ jobs:
|
|||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
|
||||
|
||||
- name: Build and push Docker image
|
||||
id: build-and-push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: ghcr.io/${{ github.repository_owner }}/lightning-pub:latest
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Capture image digest
|
||||
id: capture-digest
|
||||
run: |
|
||||
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/${{ github.repository_owner }}/lightning-pub:latest | cut -d'@' -f2)
|
||||
echo "Raw Digest is $DIGEST"
|
||||
echo "::set-output name=digest::$DIGEST"
|
||||
|
||||
- name: Debug Print Digest
|
||||
run: echo "Digest is ${{ steps.capture-digest.outputs.digest }}"
|
||||
|
||||
- name: Attest build provenance
|
||||
uses: actions/attest-build-provenance@v1
|
||||
with:
|
||||
artifact-digest: ${{ steps.push.outputs.digest }}
|
||||
artifact-type: 'container-image'
|
||||
artifact-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
materials: '[{"uri":"git+https://github.com/${{ github.repository }}","digest":{"sha1":"${{ github.sha }}"},"mediaType":"application/vnd.github.v3+json"}]'
|
||||
|
||||
- name: Push Docker image
|
||||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
subject-digest: ${{ steps.capture-digest.outputs.digest }}
|
||||
subject-name: ghcr.io/${{ github.repository_owner }}/lightning-pub:latest
|
||||
github-token: ${{ secrets.PAT_TOKEN }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue