-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (54 loc) · 1.6 KB
/
maven.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
# standard github workflow for maven project with java8
name: Java CI with Maven
on:
push:
tags:
- 'v*.*.*'
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set Build Version
run: |
if [[ "${{ github.ref }}" == "refs/tags/v"* ]]; then
TAG_VERSION=${GITHUB_REF#refs/tags/v}
echo "BUILD_VERSION=$TAG_VERSION" >> $GITHUB_ENV
else
echo "BUILD_VERSION=1.0.0-SNAPSHOT" >> $GITHUB_ENV
fi
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8
- name: Build with Maven
run: mvn -B package -Drevision=${{ env.BUILD_VERSION }} --file pom.xml
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
target/**/*.jar
target/**/*.zip
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: dpdirect
path: artifacts/
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: artifacts/*.*
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref_name }}
body: "Automated release for version ${{ github.ref_name }}."