Skip to content

Commit e64afee

Browse files
committed
Enhance CI workflow with permissions for GitHub Container Registry and enable provenance attestation for Docker Hub images
1 parent f56f4af commit e64afee

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/dockerimage.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ on:
66
pull_request:
77
branches: [ main ]
88

9+
# Add permissions needed for GitHub Container Registry
10+
permissions:
11+
contents: read
12+
packages: write
13+
id-token: write # Needed for OIDC token issuance for attestation
14+
915
jobs:
1016
build:
1117
runs-on: ubuntu-latest
@@ -25,9 +31,9 @@ jobs:
2531
id: image_names
2632
run: |
2733
DOCKERHUB_IMAGE="evandarwin/lua"
34+
# Convert GitHub repository owner to lowercase using tr
2835
OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
2936
GHCR_IMAGE="ghcr.io/${OWNER}/lua"
30-
3137
echo "dockerhub_image=$DOCKERHUB_IMAGE" >> $GITHUB_OUTPUT
3238
echo "ghcr_image=$GHCR_IMAGE" >> $GITHUB_OUTPUT
3339
@@ -81,15 +87,17 @@ jobs:
8187
${{ steps.image_names.outputs.ghcr_image }}:${{ steps.version.outputs.major_minor_version }}
8288
${{ steps.image_names.outputs.ghcr_image }}:${{ steps.version.outputs.major_version }}
8389
${{ matrix.lua-version == '5.4.7' && format('{0}:latest', steps.image_names.outputs.ghcr_image) || '' }}
84-
provenance: true
85-
outputs: type=image,name=${{ steps.image_names.outputs.dockerhub_image }}:${{ steps.version.outputs.full_version }}
90+
# Enable provenance attestation for both registries
91+
provenance: mode=max
92+
outputs: |
93+
type=image,name=${{ steps.image_names.outputs.dockerhub_image }}:${{ steps.version.outputs.full_version }}
8694
build-args: |
8795
BUILD_DATE=${{ github.event.repository.updated_at }}
8896
VCS_REF=${{ github.sha }}
8997
LUA_VERSION=${{ matrix.lua-version }}
9098
LUAROCKS_VERSION=${{ matrix.luarocks-version }}
9199
92-
- name: Generate artifact attestation
100+
- name: Generate artifact attestation for Docker Hub
93101
uses: actions/attest-build-provenance@v2
94102
with:
95103
subject-name: index.docker.io/${{ steps.image_names.outputs.dockerhub_image }}

0 commit comments

Comments
 (0)