Skip to content

Commit a0de837

Browse files
Rob Tjalmadlabordus
authored andcommitted
Rework for Docker Hub publish
Signed-off-by: Rob Tjalma <[email protected]>
1 parent 9c99020 commit a0de837

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

.github/workflows/dockerhub_deployment.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
name: Docker Hub Deployment
66

7-
on:
8-
release:
9-
types: [released]
7+
on: push
108

119
jobs:
1210
push_to_registry:
@@ -15,10 +13,28 @@ jobs:
1513
steps:
1614
- name: Check out the repo
1715
uses: actions/checkout@v2
16+
- name: Extract tag name
17+
id: extract_tagname
18+
shell: bash
19+
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
20+
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
1821
- name: Login to Docker Hub
19-
run: echo ${{ secrets.DOCKER_HUB_PASSWORD }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
20-
- name: Build and publish Docker Image
22+
uses: docker/login-action@v1
23+
with:
24+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
25+
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
26+
- name: Build Docker Image
2127
run: ./gradlew clean build -Dquarkus-profile=publishNativeImage
2228
env:
2329
GITHUB_USERNAME: "OWNER"
24-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
- name: Build and push image to Docker Hub
32+
uses: docker/build-push-action@v2
33+
with:
34+
# Set the context to use the current directory and not execute it's own git checkout.
35+
context: .
36+
push: true
37+
# Tag the images using the tagname and also latest.
38+
tags: |
39+
lfenergycompas/compas-scl-data-service:${{ steps.extract_tagname.outputs.tagname }}
40+
lfenergycompas/compas-scl-data-service:latest

app/src/main/resources/application.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ basex.password = admin
2626
%publishNativeImage.quarkus.container-image.build=true
2727
%publishNativeImage.quarkus.container-image.group=lfenergycompas
2828
%publishNativeImage.quarkus.container-image.name=compas-scl-data-service
29-
%publishNativeImage.quarkus.container-image.push=true

0 commit comments

Comments
 (0)