-
Notifications
You must be signed in to change notification settings - Fork 5
45 lines (37 loc) · 1.07 KB
/
release.yml
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
name: Release Workflow
on:
push:
branches:
- main
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 8
- name: Get the version from pom.xml
id: get_version
run: echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Fail if snapshot version
run: |
if [[ $PROJECT_VERSION == *"-SNAPSHOT"* ]]; then
echo "Snapshot versions are not releasable"
exit 0
fi
- name: Build with Maven
run: mvn clean package
- name: Create GitHub Release
if: ${{ !endsWith(env.PROJECT_VERSION, '-SNAPSHOT') }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.PROJECT_VERSION }}
files: |
target/*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}