docker fix?

This commit is contained in:
shocknet-justin 2025-09-09 15:14:33 -04:00
parent 403066efa9
commit 3c174aa5cb

View file

@ -1,6 +1,8 @@
name: Create and publish a Docker image name: Create and publish a Docker image
on: on:
push:
branches: [ main, master ]
release: release:
types: [created, published, prereleased] types: [created, published, prereleased]
workflow_dispatch: # This allows manual triggering of the workflow workflow_dispatch: # This allows manual triggering of the workflow
@ -33,7 +35,13 @@ jobs:
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/lightning-pub
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image - name: Build and push Docker image
id: build-and-push id: build-and-push
@ -42,15 +50,17 @@ jobs:
context: . context: .
file: ./Dockerfile file: ./Dockerfile
push: true push: true
tags: ghcr.io/${{ github.repository_owner }}/lightning-pub:latest tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
- name: Capture image digest - name: Capture image digest
id: capture-digest id: capture-digest
run: | run: |
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/${{ github.repository_owner }}/lightning-pub:latest | cut -d'@' -f2) # Get the first tag from the metadata output
FIRST_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' $FIRST_TAG | cut -d'@' -f2)
echo "Raw Digest is $DIGEST" echo "Raw Digest is $DIGEST"
echo "::set-output name=digest::$DIGEST" echo "digest=$DIGEST" >> $GITHUB_OUTPUT
- name: Debug Print Digest - name: Debug Print Digest
run: echo "Digest is ${{ steps.capture-digest.outputs.digest }}" run: echo "Digest is ${{ steps.capture-digest.outputs.digest }}"
@ -59,5 +69,5 @@ jobs:
uses: actions/attest-build-provenance@v1 uses: actions/attest-build-provenance@v1
with: with:
subject-digest: ${{ steps.capture-digest.outputs.digest }} subject-digest: ${{ steps.capture-digest.outputs.digest }}
subject-name: ghcr.io/${{ github.repository_owner }}/lightning-pub:latest subject-name: ${{ steps.meta.outputs.tags }}
github-token: ${{ secrets.PAT_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}