File tree Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,12 @@ on: [push]
3
3
4
4
jobs :
5
5
6
- build-java :
6
+ build-application :
7
+ name : Build application
7
8
runs-on : ubuntu-latest
8
9
environment : dockerhub
9
10
permissions :
10
- contents : read
11
+ contents : write
11
12
checks : write
12
13
id-token : write
13
14
steps :
16
17
- name : Setup Java
17
18
uses : actions/setup-java@v3
18
19
with :
19
- java-version : ' 21'
20
20
distribution : ' temurin'
21
+ java-version : ' 21'
22
+ cache : ' maven'
21
23
- name : Build application
22
24
run : |-
23
25
mvn --batch-mode clean package
@@ -33,10 +35,24 @@ jobs:
33
35
password : ${{ secrets.DOCKERHUB_TOKEN }}
34
36
- name : Set up Docker
35
37
uses : docker/setup-buildx-action@v3
36
- - name : Build and push Docker image
38
+ - name : Build Docker image
37
39
uses : docker/build-push-action@v5
38
40
with :
39
41
context : .
40
42
file : ./Dockerfile
41
- push : false
42
- tags : ${{ secrets.DOCKERHUB_USERNAME }}/flightlog:latest
43
+ push : ${{ github.ref_type == 'tag' && startsWith(github.action_ref, 'v') }}
44
+ tags : |
45
+ ${{ secrets.DOCKERHUB_USERNAME }}/flightlog:latest
46
+ ${{ secrets.DOCKERHUB_USERNAME }}/flightlog:${{ github.action_ref }}
47
+ - name : Create Release
48
+ if : ${{ github.ref_type == 'tag' && startsWith(github.action_ref, 'v') }}
49
+ uses : actions/create-release@v1
50
+ env :
51
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
52
+ with :
53
+ tag_name : ${{ github.ref }}
54
+ release_name : ${{ github.ref }}
55
+ body : |
56
+ Release automatically created by GitHub Actions
57
+ draft : false
58
+ prerelease : false
You can’t perform that action at this time.
0 commit comments