Skip to content

Commit d083454

Browse files
author
driessamyn
committed
Docker publish action.
1 parent face2aa commit d083454

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish Docker image
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
push_to_registry:
9+
name: Push Docker image to Docker Hub
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out the repo
13+
uses: actions/checkout@v2
14+
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v2
17+
with:
18+
java-version: '11'
19+
distribution: 'temurin'
20+
- name: Build with Gradle
21+
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
22+
with:
23+
arguments: jibDockerBuild
24+
25+
- name: Log in to Docker Hub
26+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
27+
with:
28+
username: ${{ secrets.DOCKER_USERNAME }}
29+
password: ${{ secrets.DOCKER_PASSWORD }}
30+
31+
- name: Extract metadata (tags, labels) for Docker
32+
id: meta
33+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
34+
with:
35+
images: driessamyn/kafkasnoop
36+
37+
- name: Build and push Docker image
38+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
39+
with:
40+
context: .
41+
push: true
42+
tags: ${{ steps.meta.outputs.tags }}
43+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)