-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (84 loc) · 2.86 KB
/
release-build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Publish release build
on:
release:
types: [ published ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'adopt'
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build
run: mvn clean verify -DskipTests=true
publish-docker:
name: Docker build image and publish
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_AUTH_TOKEN }}
- name: Get Project Version from pom.xml
uses: entimaniac/[email protected]
id: getVersion
- name: Push Version ${{ steps.getVersion.outputs.version }}
uses: docker/build-push-action@v5
with:
push: true
tags: netgrif/etask-backend:${{ steps.getVersion.outputs.version }}
- name: Push Latest
if: ${{ !contains(steps.getVersion.outputs.version, '-SNAPSHOT') }}
uses: docker/build-push-action@v5
with:
push: true
tags: netgrif/etask-backend:latest
publish-assets:
name: Upload Release Assets
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
security-events: write
steps:
- uses: actions/checkout@v4
- name: Build
run: mvn clean package install -DskipTests=true
- name: Get Project Version from pom.xml
uses: entimaniac/[email protected]
id: getVersion
- name: Build project
run: |
mkdir -p netgrif-etask-${{ steps.getVersion.outputs.version }}/src/main/resources/
cp target/*-exec.jar netgrif-etask-${{ steps.getVersion.outputs.version }}
cp -R src/main/resources/* netgrif-etask-${{ steps.getVersion.outputs.version }}/src/main/resources/
zip -r netgrif-etask-${{ steps.getVersion.outputs.version }}.zip netgrif-etask-${{ steps.getVersion.outputs.version }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: netgrif-etask-${{ steps.getVersion.outputs.version }}.zip
asset_name: netgrif-etask-${{ steps.getVersion.outputs.version }}.zip
tag: ${{ github.ref }}
overwrite: true