Skip to content

Commit f703dad

Browse files
fix: add DockerHub publishing workflow (#12)
1 parent 737dc0e commit f703dad

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/docker.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish Image to DockerHub
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: get-npm-version
16+
id: package-version
17+
uses: martinbeentjes/npm-get-version-action@v1.3.1
18+
19+
- name: DockerHub Login
20+
uses: docker/login-action@v3
21+
with:
22+
username: ${{ secrets.DOCKERHUB_USERNAME }}
23+
password: ${{ secrets.DOCKERHUB_TOKEN }}
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Read YAML file for version
29+
uses: pietrobolcato/action-read-yaml@1.0.0
30+
id: read_yaml
31+
with:
32+
config: ${{ github.workspace }}/version.yaml
33+
34+
- name: Build and push Docker image
35+
uses: docker/build-push-action@v6
36+
with:
37+
context: .
38+
file: ./Dockerfile
39+
push: true
40+
tags: |
41+
${{ secrets.DOCKERHUB_USERNAME }}/contributor:latest
42+
${{ secrets.DOCKERHUB_USERNAME }}/contributor:${{ steps.read_yaml.outputs['version'] }}
43+
platforms: linux/amd64,linux/arm64,linux/arm/v7

0 commit comments

Comments
 (0)