Skip to content

Commit 96a8c8b

Browse files
feat: use autogenerated metadata & attestations
1 parent b912dd3 commit 96a8c8b

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

.github/workflows/docker.yaml

+22-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
name: Docker image
22

33
on:
4-
workflow_dispatch:
4+
release:
5+
types: [published]
56

67
permissions:
78
packages: write
9+
attestations: write
810

911
env:
10-
IMAGE_NAME: qemu-docker-anti-detection
11-
IMAGE_REGISTRY: ghcr.io/winapps-org
12-
REGISTRY_USER: actions
13-
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
12+
IMAGE_REGISTRY: ghcr.io
13+
IMAGE_NAME: winapps-org/qemu-docker-anti-detection
1414

1515
jobs:
1616
build:
@@ -36,12 +36,19 @@ jobs:
3636
echo "build=$(date --rfc-3339 ns)" >> $GITHUB_OUTPUT
3737
echo "tag=$(date +%Y%m%d)" >> $GITHUB_OUTPUT
3838
39+
- name: Extract metadata (tags, labels) for Docker
40+
id: meta
41+
uses: docker/metadata-action@v4
42+
with:
43+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
3945
- name: Build image
4046
id: base
4147
uses: redhat-actions/buildah-build@v2
4248
with:
4349
image: ${{ env.IMAGE_NAME }}
44-
tags: ${{ steps.date.outputs.tag }} latest
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels
4552
context: .
4653
platforms: linux/${{ matrix.platform }}
4754
containerfiles: |
@@ -57,5 +64,12 @@ jobs:
5764
image: ${{ steps.base.outputs.image }}
5865
tags: ${{ steps.base.outputs.tags }}
5966
registry: ${{ env.IMAGE_REGISTRY }}
60-
username: ${{ env.REGISTRY_USER }}
61-
password: ${{ env.REGISTRY_PASSWORD }}
67+
username: ${{ github.actor }}
68+
password: ${{ secrets.GITHUB_TOKEN }}
69+
70+
- name: Generate artifact attestation
71+
uses: actions/attest-build-provenance@v1
72+
with:
73+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
74+
subject-digest: ${{ steps.push.outputs.digest }}
75+
push-to-registry: true

0 commit comments

Comments
 (0)