-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (47 loc) · 1.58 KB
/
gradle.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
46
47
48
49
50
51
52
53
54
55
56
57
name: Build and Release
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew shadowJar
- name: Extract version from build.gradle
id: extract_version
run: |
VERSION=$(grep '^version ' build.gradle | awk '{print $3}' | tr -d "'")
echo "Extracted version is $VERSION"
echo "::set-output name=version::$VERSION"
- name: Check if Tag Exists
id: check_tag
run: |
if git rev-parse "v${{ steps.extract_version.outputs.version }}" >/dev/null 2>&1; then
echo "::set-output name=exists::true"
else
echo "::set-output name=exists::false"
fi
- name: Create Tag
# You may pin to the exact commit or the version.
# uses: negz/create-tag@39bae1e0932567a58c20dea5a1a0d18358503320
uses: negz/create-tag@v1
if: steps.check_tag.outputs.exists == 'false'
continue-on-error: true
with:
token: ${{secrets.TEST}}
version: "v${{ steps.extract_version.outputs.version }}"
message: ""
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
token: ${{secrets.TEST}}
tag_name: "v${{ steps.extract_version.outputs.version }}"
name: "Release v${{ steps.extract_version.outputs.version }}"
files: build/libs/*.jar