Skip to content

Commit e70090f

Browse files
committed
ci: attempt to fix DCT key
1 parent 5f77e53 commit e70090f

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

.github/workflows/build-publish-signed.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,24 @@ jobs:
2121
with:
2222
fetch-depth: 0
2323

24-
- name: Load DCT delegation key
25-
env:
26-
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ secrets.DCT_KEY_PASSPHRASE }}
27-
DCT_KEY_BASE64: ${{ secrets.DCT_KEY_BASE64 }}
28-
run: |
29-
echo "$DCT_KEY_BASE64" | base64 -d > delegation.key
30-
chmod 600 delegation.key
31-
docker trust key load delegation.key --name gha
32-
3324
- name: Login to DockerHub
3425
uses: docker/login-action@v3
3526
with:
3627
username: ${{ secrets.DOCKERHUB_USERNAME }}
3728
password: ${{ secrets.DOCKERHUB_TOKEN }}
3829

30+
- name: Load DCT delegation key
31+
env:
32+
DOCKER_CONTENT_TRUST: 1
33+
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ secrets.DCT_KEY_PASSPHRASE }}
34+
DCT_KEY_PATH: ~/.docker/trust/private/${{ vars.DCT_KEY_ID }}.key
35+
run: |
36+
mkdir -p ~/.docker/trust/private
37+
chmod -R 700 ~/.docker/trust
38+
echo "${{ secrets.DCT_KEY_BASE64 }}" | base64 -d > "$DCT_KEY_PATH"
39+
chmod 600 "$DCT_KEY_PATH"
40+
docker trust key load "$DCT_KEY_PATH"
41+
3942
- name: Build the image
4043
run: docker build -t ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} .
4144

@@ -50,4 +53,6 @@ jobs:
5053
docker trust inspect --pretty ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
5154
5255
- name: Remove DCT delegation key
53-
run: rm delegation.key
56+
if: always()
57+
run: |
58+
rm -rf ~/.docker/trust/private

0 commit comments

Comments
 (0)