Skip to content

Commit f6f395b

Browse files
committed
ci: working out ci build
1 parent 9378f94 commit f6f395b

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# GitHub recommends pinning actions to a commit SHA.
7+
# To get a newer version, you will need to update the SHA.
8+
# You can also reference a tag or branch, but the action may change without warning.
9+
10+
name: Publish Docker image
11+
12+
on:
13+
release:
14+
types: [published]
15+
16+
jobs:
17+
push_to_registry:
18+
name: Push Docker image to Docker Hub
19+
runs-on: ubuntu-latest
20+
permissions:
21+
packages: write
22+
contents: read
23+
attestations: write
24+
id-token: write
25+
steps:
26+
- name: Check out the repo
27+
uses: actions/checkout@v4
28+
29+
- name: Log in to Docker Hub
30+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
31+
with:
32+
username: ${{ secrets.DOCKER_USERNAME }}
33+
password: ${{ secrets.DOCKER_PASSWORD }}
34+
35+
- name: Extract metadata (tags, labels) for Docker
36+
id: meta
37+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
38+
with:
39+
images: my-docker-hub-namespace/my-docker-hub-repository
40+
41+
- name: Build and push Docker image
42+
id: push
43+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
44+
with:
45+
context: .
46+
file: ./docker/Dockerfile
47+
push: true
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}
50+
51+
- name: Generate artifact attestation
52+
uses: actions/attest-build-provenance@v2
53+
with:
54+
subject-name: index.docker.io/my-docker-hub-namespace/my-docker-hub-repository
55+
subject-digest: ${{ steps.push.outputs.digest }}
56+
push-to-registry: true

0 commit comments

Comments
 (0)