Skip to content

Commit 67665aa

Browse files
committed
Add workflow to publish Docker image to Docker Hub
* Workflow is triggered when a release is triggered
1 parent 2a9d85d commit 67665aa

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish Docker Image
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
push_to_registry:
9+
name: Push Docker image to Docker Hub
10+
runs-on: ubuntu-latest
11+
permissions:
12+
packages: write
13+
contents: read
14+
attestations: write
15+
id-token: write
16+
steps:
17+
- name: Check out the repo
18+
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
19+
20+
- name: Log in to Docker Hub
21+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
22+
with:
23+
username: ${{ secrets.DOCKERHUB_USERNAME }}
24+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
25+
26+
- name: Extract metadata (tags, labels) for Docker
27+
id: meta
28+
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051
29+
with:
30+
images: codeforafrica/pesacheck-ghost
31+
32+
- name: Build and push Docker image
33+
id: push
34+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
35+
with:
36+
context: .
37+
file: ./Dockerfile
38+
push: true
39+
tags: ${{ steps.meta.outputs.tags }}
40+
labels: ${{ steps.meta.outputs.labels }}
41+
42+
- name: Generate artifact attestation
43+
uses: actions/attest-build-provenance@v3
44+
with:
45+
subject-name: index.docker.io/codeforafrica/pesacheck-ghost
46+
subject-digest: ${{ steps.push.outputs.digest }}
47+
push-to-registry: true

0 commit comments

Comments
 (0)