@@ -60,13 +60,11 @@ jobs:
60
60
env :
61
61
SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
62
62
run : |
63
- REPO_NAME=$(echo "${{ github.repository }}" | cut -d '/' -f 2)
64
-
65
63
mvn verify -B -P prod,coverage "-Dstyle.color=always" \
66
64
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
67
65
-Dsonar.host.url="https://sonarcloud.io" \
68
- -Dsonar.organization=soat-tech-challenge \
69
- -Dsonar.projectKey=soat-tech-challenge_$REPO_NAME
66
+ -Dsonar.organization=${{ github.repository_owner }} \
67
+ -Dsonar.projectKey=${{ github.repository_owner }}_${{ github.event.repository.name }}
70
68
71
69
- name : Commit, Tag and Push New Version
72
70
id : bump
@@ -75,14 +73,21 @@ jobs:
75
73
commit-message : " [skip ci] Bump version to"
76
74
version : ${{ steps.semver.outputs.nextStrict }}
77
75
78
- - name : Upload Artifact
76
+ - name : Upload JAR Artifact
79
77
id : upload
80
78
uses : actions/upload-artifact@v4
81
79
with :
82
- name : app -${{ steps.semver.outputs.nextStrict }}
83
- path : target/app .jar
80
+ name : ${{ github.event.repository.name }} -${{ steps.semver.outputs.nextStrict }}
81
+ path : target/* .jar
84
82
if-no-files-found : error
85
83
84
+ - name : Upload Coverage Report Artifact
85
+ id : upload
86
+ uses : actions/upload-artifact@v4
87
+ with :
88
+ name : ${{ github.event.repository.name }}-${{ steps.semver.outputs.nextStrict }}-coverage-report
89
+ path : target/site/jacoco/*
90
+
86
91
docker :
87
92
name : Docker Build and Push
88
93
if : ${{ inputs.docker == true || inputs.docker == 'true' }}
@@ -96,22 +101,40 @@ jobs:
96
101
- name : Checkout
97
102
uses : actions/checkout@v3
98
103
99
- - name : Download Artifact
104
+ - name : Download JAR Artifact
100
105
uses : actions/download-artifact@v4
101
106
with :
102
107
name : ${{ needs.build.outputs.artifact_name }}
103
- path : target/app .jar
108
+ path : target/* .jar
104
109
105
110
- name : Login to Docker Hub
106
111
uses : docker/login-action@v3
107
112
with :
108
113
username : ${{ inputs.dockerhub_username }}
109
114
password : ${{ secrets.DOCKERHUB_TOKEN }}
110
115
116
+ - name : Get Docker Metadata
117
+ id : meta
118
+ uses : docker/metadata-action@v3
119
+ with :
120
+ images : ${{ inputs.dockerhub_username }}/${{ github.event.repository.name }}
121
+ labels : |
122
+ org.opencontainers.image.authors=${{ github.event.repository.owner.html_url }}#group-members
123
+ org.opencontainers.image.title=${{ github.event.repository.name }}
124
+ org.opencontainers.image.description=${{ github.event.repository.description }}
125
+ org.opencontainers.image.url=https://hub.docker.com/r/${{ inputs.dockerhub_username }}/${{ github.event.repository.name }}
126
+ org.opencontainers.image.documentation=${{ github.event.repository.html_url }}/wiki
127
+ org.opencontainers.image.source=${{ github.event.repository.html_url }}
128
+ org.opencontainers.image.version=${{ needs.build.outputs.new_tag }}
129
+ org.opencontainers.image.created=${{ github.event.repository.pushed_at }}
130
+ org.opencontainers.image.revision=${{ github.sha }}
131
+ org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
132
+
111
133
- name : Build and push image
112
134
id : docker_build_push
113
135
uses : docker/build-push-action@v5
114
136
with :
115
137
context : .
116
138
push : true
117
- tags : ${{ inputs.image_name }}:${{ needs.build.outputs.new_tag }},${{ inputs.image_name }}:latest
139
+ tags : ${{ steps.meta.outputs.tags }}
140
+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments