Skip to content

Commit 16130a7

Browse files
committed
ci: push to github package
1 parent b58f2b5 commit 16130a7

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

.github/workflows/docker-push.yml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,53 @@ on:
44
release:
55
types: [published]
66

7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
10+
711
jobs:
8-
push_to_registry:
12+
build-and-push-image:
13+
runs-on: ubuntu-latest
14+
name: "Build and Push to Github Package"
15+
permissions:
16+
contents: read
17+
packages: write
18+
attestations: write
19+
id-token: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
- name: Log in to the Container registry
25+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
26+
with:
27+
registry: ${{ env.REGISTRY }}
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Extract metadata (tags, labels) for Docker
32+
id: meta
33+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
34+
with:
35+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
36+
37+
- name: Build and push Docker image
38+
id: push
39+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
40+
with:
41+
context: .
42+
push: true
43+
tags: ${{ steps.meta.outputs.tags }}
44+
labels: ${{ steps.meta.outputs.labels }}
45+
46+
- name: Generate artifact attestation
47+
uses: actions/attest-build-provenance@v1
48+
with:
49+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
50+
subject-digest: ${{ steps.push.outputs.digest }}
51+
push-to-registry: true
52+
53+
push_to_docker_hub:
954
name: Push Docker image to Docker Hub
1055
runs-on: ubuntu-latest
1156
steps:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.env
2+
bin/act

0 commit comments

Comments
 (0)