-
Notifications
You must be signed in to change notification settings - Fork 18
53 lines (43 loc) · 1.59 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
name: Java CI with Gradle
on:
push:
paths:
- '**.java' # <- Only build, test and publish MineTinker if any .java-files or .yml-files have changed
- '**.yml'
- '**build.gradle'
- '**settings.gradle'
pull_request:
paths:
- '**.java'
- '**.yml'
- '**build.gradle'
- '**settings.gradle'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 16
uses: actions/setup-java@v3
with:
java-version: '16'
distribution: 'adopt'
- name: Preparing build.gradle # <- Only necessary for publishing - changes the version number dependent on the commit sha
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: sed -i -E "/^version/ s/'($|[^a-zA-Z_0-9])/-${{ github.sha }}'/g" ./build.gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Setting up Python for publishing
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: pip3 install requests # Request is needed for publishing over web hook
- name: Publishing Build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: python3 .github/workflows/scripts/publish.py ./build/libs/MineTinker.jar MineTinker ${{ secrets.DiscordWebHook }} ${{ github.sha }}
- name: Upload artifact
uses: actions/[email protected]
with:
name: MineTinker-${{ github.sha }}.jar
path: ./build/libs/MineTinker.jar
if-no-files-found: error