@@ -12,60 +12,65 @@ jobs:
1212 build :
1313 name : Build
1414 runs-on : ubuntu-latest
15- outputs :
16- VERSION : ${{ steps.version.outputs.VERSION }}
1715 steps :
18- - name : Checkout Code
16+ - name : Checkout repository
1917 uses : actions/checkout@v4
20- with :
21- fetch-depth : 0
22- fetch-tags : " true"
23-
24- - name : Set Up Java
25- uses : actions/setup-java@v4
26- with :
27- distribution : " temurin"
28- java-version : " 17"
2918
30- # Use cache to speed up build
31- - name : Cache Maven Repo
32- uses : actions/cache@v4
33- id : cache
19+ - name : Set up JDK 17
20+ uses : actions/setup-java@v5
3421 with :
35- path : ~/.m2/repository
36- key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
22+ java-version : 17
23+ distribution : temurin
24+ cache : maven
3725
38- - name : Get version
39- run : |
40- TAG=$(git describe --tags --always)
41- echo "VERSION=${TAG#v}" >> $GITHUB_OUTPUT
42- id : version
26+ - name : Build With Maven
27+ run : mvn -B package --file pom.xml
4328
44- - name : Set version
45- run : mvn -B versions:set -DnewVersion=${{ steps.version.outputs.VERSION }} -DgenerateBackupPoms=false
29+ publish :
30+ name : Publish
31+ runs-on : ubuntu-latest
4632
47- - name : Build With Maven
48- run : mvn -e clean package -am -P all
33+ steps :
34+ - name : Checkout repository
35+ uses : actions/checkout@v4
4936
50- - name : Upload Distributable Jar
51- id : upload-final
52- uses : actions/upload-artifact@v4
37+ - name : Set up JDK 17
38+ uses : actions/setup-java@v5
5339 with :
54- name : dist
55- path : ./target/AnvilUnlocker-${{ steps.version.outputs.VERSION }}.jar
40+ java-version : 17
41+ distribution : temurin
42+ cache : maven
5643
57- release :
58- name : Create Github Release
59- needs : [ build ]
60- if : github.event_name == 'release'
61- runs-on : ubuntu-latest
62- steps :
63- - name : Download Artifacts
64- uses : actions/download-artifact@v4
44+ - name : Set version from release tag
45+ run : mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false
46+
47+ - name : Build and package Maven project
48+ run : mvn -B clean package --file pom.xml
6549
6650 - name : Upload to release
67- uses : JasonEtco/upload-to-release@master
51+ uses :
cloudnode-pro/[email protected] 52+ with :
53+ gh-token : ${{ github.token }}
54+ files : target/AnvilUnlocker-${{ github.event.release.tag_name }}.jar; type=application/java-archive
55+
56+ - name : Upload to Modrinth
57+ uses : cloudnode-pro/modrinth-publish@v2
6858 with :
69- args : ./dist/AnvilUnlocker-${{ needs.build.outputs.VERSION }}.jar application/java-archive
70- env :
71- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
59+ token : ${{ secrets.MODRINTH_TOKEN }}
60+ project : ${{ github.event.repository.custom_properties.modrinth_id }}
61+ name : ${{ github.event.release.name == github.event.release.tag_name && format('AnvilUnlocker {0}', github.event.release.name) || github.event.release.name }}
62+ version : ${{ github.event.release.tag_name }}
63+ changelog : ${{ github.event.release.body }}
64+ loaders : |-
65+ paper
66+ bukkit
67+ spigot
68+ game-versions : |-
69+ 1.15.x
70+ 1.16.x
71+ 1.17.x
72+ 1.18.x
73+ 1.19.x
74+ 1.20.x
75+ 1.21.x
76+ files : target/AnvilUnlocker-${{ github.event.release.tag_name }}.jar
0 commit comments