Skip to content

Commit 7cba521

Browse files
committedJan 29, 2025·
Fix CI to push releases to Docker Hub
1 parent 9153c35 commit 7cba521

File tree

1 file changed

+15
-30
lines changed

1 file changed

+15
-30
lines changed
 

‎.github/workflows/dockerhub-push.yml

+15-30
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ name: HMDA Docker Hub Image Push
22

33
on:
44
push:
5-
branches:
6-
- master
5+
tags:
6+
- '*' # Push events to every tag not containing /
7+
8+
env:
9+
REGISTRY: hmda/hmda-platform
710

811
jobs:
912
push_to_dockerhub:
@@ -14,39 +17,21 @@ jobs:
1417
- name: Check out the repo
1518
uses: actions/checkout@v4
1619

17-
- name: Log in to Docker Hub
18-
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
19-
with:
20-
username: ${{ secrets.DOCKERHUB_USERNAME }}
21-
password: ${{ secrets.DOCKERHUB_PASSWORD }}
20+
- name: Setup sbt launcher
21+
uses: sbt/setup-sbt@v1
2222

2323
- name: Build image of HMDA Platform only
2424
run: |
25-
sbt -batch clean hmda-platform/docker:publishLocal
26-
continue-on-error: true
25+
sbt "project hmda-platform" dockerPublishLocalSkipTests
2726
2827
- name: Tag Docker image
29-
run: docker tag $(docker images --filter=reference="hmda/hmda-platform:latest" --format "{{.ID}}") ${{ secrets.DOCKERHUB_USERNAME }}/hmda:latest
30-
31-
- name: Push image to Docker Hub
32-
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/hmda:latest
28+
run: docker tag $(docker images --filter=reference="hmda/hmda-platform:latest" --format "{{.ID}}") ${{ env.REGISTRY }}:${{ github.ref_name }}
3329

34-
- name: Run Docker Scout CVE scan
35-
if: ${{ github.event_name != 'pull_request_target' }}
36-
uses: docker/scout-action@v1
37-
with:
38-
command: cves
39-
image: ${{ secrets.DOCKERHUB_USERNAME }}/hmda:latest
40-
sarif-file: sarif.output.json
41-
summary: true
42-
43-
- name: Upload CVE scan to artifact
44-
if: ${{ github.event_name != 'pull_request_target' }}
45-
uses: github/codeql-action/upload-sarif@v2
30+
- name: Log in to Docker Hub
31+
uses: docker/login-action@v3
4632
with:
47-
sarif_file: sarif.output.json
33+
username: ${{ secrets.DOCKERHUB_USERNAME }}
34+
password: ${{ secrets.DOCKERHUB_TOKEN }}
4835

49-
- name: Post comment with report link
50-
uses: thollander/actions-comment-pull-request@v3
51-
with:
52-
message: CVE scan report generated by Docker Scout are available. Check the Actions tab to download the report.
36+
- name: Push image to Docker Hub
37+
run: docker push ${{ env.REGISTRY }}:${{ github.ref_name }}

0 commit comments

Comments
 (0)
Please sign in to comment.