Skip to content

Commit 55025ce

Browse files
committed
build: add Docker steps to github workflows
1 parent ac30164 commit 55025ce

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

.github/workflows/cd.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish to container registries
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
docker-hub:
9+
name: Push Docker image to Docker Hub
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
13+
14+
- name: Log in to Docker Hub
15+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
16+
with:
17+
username: ${{ secrets.DOCKER_USERNAME }}
18+
password: ${{ secrets.DOCKER_PASSWORD }}
19+
20+
- name: Build and push Docker image
21+
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
22+
with:
23+
context: .
24+
push: true
25+
tags: "${{ github.repository }}:${{ github.event.release.tag_name }}-alpine"
26+
27+
ghcr-io:
28+
name: Push Docker image to ghcr.io
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33+
34+
- name: Log in to GHCR
35+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Build and push Docker image
42+
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
43+
with:
44+
context: .
45+
push: true
46+
tags: "ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}-alpine"

.github/workflows/ci.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,19 @@ jobs:
106106
token: ${{ secrets.CODECOV_TOKEN }}
107107

108108
- run: uv run --frozen coverage report --fail-under 83
109+
110+
docker:
111+
runs-on: ubuntu-latest
112+
needs: [lint, coverage, mypy]
113+
steps:
114+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
115+
- name: Build Docker image
116+
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
117+
with:
118+
context: .
119+
push: false
120+
tags: "${{ github.repository }}:devel"
121+
109122
# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
110123
check:
111124
if: always()

0 commit comments

Comments
 (0)