-
-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (129 loc) · 4.12 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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: CI
on:
push:
branches: [ "**" ]
pull_request:
types:
- opened
- synchronize
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up JDK 21
uses: actions/[email protected]
with:
java-version: 21
distribution: 'adopt'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/actions/[email protected]
- name: Build with Gradle
run: ./gradlew build --warning-mode all
paths-filter:
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.filter.outputs.java }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
java:
- 'src/**'
- 'build.gradle.kts'
createJar:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up JDK 21
uses: actions/[email protected]
with:
java-version: 21
distribution: 'adopt'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/actions/[email protected]
- name: Set version env variable
run: |
echo "runnumber=${{ github.run_number }}" >> $GITHUB_ENV
- run: ./gradlew jar
- name: Upload artifact
uses: actions/[email protected]
with:
name: StationofdoomPlugin
path: build/libs
publishToRegistry:
runs-on: ubuntu-latest
needs: [build, paths-filter]
if: ${{ github.ref == 'refs/heads/master' && needs.paths-filter.outputs.output1 == 'true' }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up JDK 21
uses: actions/[email protected]
with:
java-version: 21
distribution: 'adopt'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/actions/[email protected]
- name: Set env variables
run: |
echo "REPOSILITE_USER=${{ secrets.REPOSILITE_USER }}" >> $GITHUB_ENV
echo "REPOSILITE_PW=${{ secrets.REPOSILITE_PW }}" >> $GITHUB_ENV
- name: Publish
run: |
./gradlew publish -PtargetRepo=snapshots
env:
MAVEN_USERNAME: ${{ secrets.REPOSILITE_USER }}
MAVEN_PASSWORD: ${{ secrets.REPOSILITE_PW }}
releaseJar:
runs-on: ubuntu-latest
needs: [createJar, paths-filter]
if: ${{ github.ref == 'refs/heads/master' && needs.paths-filter.outputs.output1 == 'true' }}
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: StationofdoomPlugin
path: build/libs
- name: Check folder
run: ls build/libs
- name: Get file name
id: get_filename
run: |
FILE_PATH=$(find build/libs -name "*.jar" | head -n 1)
FILE_NAME=$(basename "$FILE_PATH")
version=$(echo "$FILE_NAME" | grep -o '[0-9.]\+')
version="${version%.}"
echo "$version"
echo "FILENAME=$version" >> $GITHUB_ENV
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: "build/libs/*.jar"
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
tag: "v${{ env.FILENAME }}"
publishToModrinth:
runs-on: ubuntu-latest
needs: [createJar, releaseJar]
if: ${{ github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up JDK 21
uses: actions/[email protected]
with:
java-version: 21
distribution: 'adopt'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/actions/[email protected]
- name: Set env variables
run: |
echo "runnumber=${{ github.run_number }}" >> $GITHUB_ENV
echo "MODRINTH_TOKEN=${{ secrets.MODRINTH_TOKEN }}" >> $GITHUB_ENV
- run: ./gradlew modrinth