Skip to content

Commit 1c632ab

Browse files
committed
Prepare release
1 parent 5b77a48 commit 1c632ab

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ on: [push]
33

44
jobs:
55

6-
build-java:
6+
build-application:
7+
name: Build application
78
runs-on: ubuntu-latest
89
environment: dockerhub
910
permissions:
10-
contents: read
11+
contents: write
1112
checks: write
1213
id-token: write
1314
steps:
@@ -16,8 +17,9 @@ jobs:
1617
- name: Setup Java
1718
uses: actions/setup-java@v3
1819
with:
19-
java-version: '21'
2020
distribution: 'temurin'
21+
java-version: '21'
22+
cache: 'maven'
2123
- name: Build application
2224
run: |-
2325
mvn --batch-mode clean package
@@ -33,10 +35,24 @@ jobs:
3335
password: ${{ secrets.DOCKERHUB_TOKEN }}
3436
- name: Set up Docker
3537
uses: docker/setup-buildx-action@v3
36-
- name: Build and push Docker image
38+
- name: Build Docker image
3739
uses: docker/build-push-action@v5
3840
with:
3941
context: .
4042
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

0 commit comments

Comments
 (0)