Skip to content

Commit 7ee376b

Browse files
committed
👷 add Docker publish workflow
1 parent 62224e7 commit 7ee376b

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

.github/workflows/docker.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish Docker image
2+
3+
on:
4+
workflow_call:
5+
defaults:
6+
run:
7+
shell: bash
8+
permissions: read-all
9+
10+
jobs:
11+
push_to_registry:
12+
name: Push Docker image to Docker Hub
13+
runs-on: ubuntu-latest
14+
environment:
15+
name: docker
16+
url: https://hub.docker.com/r/klement/mysql-to-sqlite
17+
steps:
18+
- name: Check out the repo
19+
uses: actions/checkout@v4
20+
- name: Docker meta
21+
id: meta
22+
uses: docker/metadata-action@v5
23+
with:
24+
images: |
25+
klement/mysql-to-sqlite
26+
ghcr.io/${{ github.repository }}
27+
tags: |
28+
type=ref,event=branch
29+
type=ref,event=pr
30+
type=semver,pattern={{version}}
31+
type=semver,pattern={{major}}.{{minor}}.{{patch}}
32+
- name: Log in to Docker Hub
33+
uses: docker/login-action@v3
34+
with:
35+
username: ${{ secrets.DOCKERHUB_USERNAME }}
36+
password: ${{ secrets.DOCKERHUB_TOKEN }}
37+
- name: Log in to the Container registry
38+
uses: docker/login-action@v3
39+
with:
40+
registry: ghcr.io
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
- name: Build and push
44+
uses: docker/build-push-action@v5
45+
with:
46+
context: .
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/publish.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,8 @@ jobs:
8989
if: ${{ always() }}
9090
run: |
9191
rm -rf dist
92-
rm -rf $CHANGELOG_PATH
92+
rm -rf $CHANGELOG_PATH
93+
docker:
94+
needs: build-and-publish
95+
uses: ./.github/workflows/docker.yml
96+
secrets: inherit

0 commit comments

Comments
 (0)