Skip to content

Commit c31ede4

Browse files
committed
Use docker actions to publish
1 parent babb018 commit c31ede4

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

.github/workflows/deploy.yml

+34-4
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,44 @@ on:
66
jobs:
77
build:
88
runs-on: ubuntu-latest
9+
env:
10+
REGISTRY: docker.io
11+
IMAGE_NAME: knuthuehne/jedeschule-api
12+
permissions:
13+
packages: write
14+
contents: read
15+
attestations: write
16+
id-token: write
917
steps:
10-
- uses: actions/checkout@v1
11-
- name: Publish to Registry
12-
uses: elgohr/[email protected]
18+
- uses: actions/checkout@v4
19+
- name: Log in to Docker Hub
20+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
1321
with:
14-
name: knuthuehne/jedeschule-api
1522
username: ${{ secrets.DOCKERHUB_USERNAME }}
1623
password: ${{ secrets.DOCKERHUB_PASSWORD }}
24+
- name: Extract metadata (tags, labels) for Docker
25+
id: meta
26+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
27+
with:
28+
images: ${{ env.IMAGE_NAME}}
29+
tags: |
30+
type=raw,value=latest
31+
type=sha
32+
- name: Build and push Docker image
33+
id: push
34+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
35+
with:
36+
context: .
37+
file: ./Dockerfile
38+
push: true
39+
tags: ${{ steps.meta.outputs.tags }}
40+
labels: ${{ steps.meta.outputs.labels }}
41+
- name: Generate artifact attestation
42+
uses: actions/attest-build-provenance@v2
43+
with:
44+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
45+
subject-digest: ${{ steps.push.outputs.digest }}
46+
push-to-registry: true
1747
deploy:
1848
needs: build
1949
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)