77 required : true
88 default : ' 1.0'
99 mc_version :
10- description : ' Minecraft version(s) the data pack runs in'
10+ description : ' Minecraft version(s) the data pack runs in (human readable) '
1111 required : true
12- default : ' 1.20'
12+ default : ' 1.17x-1.21x'
13+ mc_version_range :
14+ description : ' Minecraft version(s) the data pack runs in (encoded in version range spec)'
15+ required : true
16+ default : ' >=1.17 <=1.21'
1317
1418jobs :
15- create_data_pack :
19+ deploy :
1620 runs-on : ubuntu-latest
21+ name : Build and publish project
1722 steps :
1823 - name : Checkout code
19- uses : actions/checkout@v3.5.3
24+ uses : actions/checkout@v4
25+ with :
26+ show-progress : false
2027 - name : Extract tag
2128 id : tag_version
2229 run : echo "TAG_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
30+
31+ # Automatically set version numbers
2332 - name : Find and replace uninstall file name
2433 uses : jacobtomlinson/gha-find-replace@v3
2534 with :
@@ -33,78 +42,153 @@ jobs:
3342 find : " ${version}"
3443 replace : ${{ github.event.inputs.tag }}
3544 regex : false
45+ - name : Find and replace supported mc versions
46+ uses : jacobtomlinson/gha-find-replace@v3
47+ with :
48+ find : " ${mc_version}"
49+ replace : ${{ github.event.inputs.mc_version }}
50+ regex : false
3651
3752 # Check for existence of datapack, mod and/or resourcepack folders.
3853 - name : Check for data folder
3954 id : check_datapack_folder
40- uses : andstor/file-existence-action@v2
55+ uses : andstor/file-existence-action@v3
4156 with :
4257 files : " data"
4358 - name : Check for mod folders
4459 id : check_mod_folder
45- uses : andstor/file-existence-action@v2
60+ uses : andstor/file-existence-action@v3
4661 with :
4762 files : " META-INF, net, fabric.mod.json, assets"
4863 - name : Check for resource pack folder
4964 id : check_assets_folder
50- uses : andstor/file-existence-action@v2
65+ uses : andstor/file-existence-action@v3
5166 with :
5267 files : " assets/minecraft"
5368
69+ # Package project
5470 - name : Create data pack zip file
5571 uses : montudor/action-zip@v1
5672 if : steps.check_datapack_folder.outputs.files_exists == 'true'
5773 with :
58- args : zip -qq datapack.zip -r data pack.mcmeta pack.png LICENSE README .md
74+ args : zip -qq "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}- datapack.zip" -r . -x assets/* net/* META-INF/* fabric.mod.json unused/* src/* wiki/* other_editions/* CHANGES .md ".*"
5975 - name : Create mod jar file
6076 uses : montudor/action-zip@v1
6177 if : steps.check_mod_folder.outputs.files_exists == 'true'
6278 with :
63- args : zip -qq mod.zip -r data assets META-INF net fabric.mod.json pack.mcmeta pack.png LICENSE README.md
79+ args : zip -qq "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}- mod.jar" -r . -x unused/* src/* wiki/* other_editions/* CHANGES.md ".*" "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-datapack.zip"
6480 - name : Create asset pack zip file
6581 uses : montudor/action-zip@v1
6682 if : steps.check_assets_folder.outputs.files_exists == 'true'
6783 with :
68- args : zip -qq assetpack. zip -r assets pack.mcmeta pack.png LICENSE README .md
84+ args : zip -qq "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-resourcepack. zip" -r . -x data/* net/* META-INF/* fabric.mod.json unused/* src/* wiki/* other_editions/* CHANGES .md ".*" "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-datapack.zip" "${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-mod.jar"
6985
70- - name : Create release
71- id : create_release
72- uses : actions/create-release@v1
73- env :
74- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
75- with :
76- tag_name : v${{ github.event.inputs.tag }}
77- release_name : Release v${{ github.event.inputs.tag }}
78- draft : false
79- prerelease : false
80-
81- - name : Upload datapack release asset
82- uses : actions/upload-release-asset@v1
86+ # Upload
87+ - name : Upload data pack version to Modrinth
88+ uses : Kir-Antipov/mc-publish@v3.3
8389 if : steps.check_datapack_folder.outputs.files_exists == 'true'
84- env :
85- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
8690 with :
87- upload_url : ${{ steps.create_release.outputs.upload_url }}
88- asset_path : ./datapack.zip
89- asset_name : ${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-datapack.zip
90- asset_content_type : application/zip
91- - name : Upload mod release asset
92- uses : actions/upload-release-asset@v1
91+ modrinth-id : zrzYrlm0
92+ modrinth-token : ${{ secrets.MODRINTH_TOKEN }}
93+ game-versions : ${{ github.event.inputs.mc_version_range }}
94+ game-version-filter : any
95+ fail-mode : skip
96+
97+ name : " [DP] Release v${{ github.event.inputs.tag }}"
98+ version : ${{ github.event.inputs.tag }}
99+ changelog-file : CHANGES.md
100+
101+ loaders : |
102+ datapack
103+ files : |
104+ ./${{ github.event.repository.name }}-*.zip
105+
106+ - name : Upload mod version to Modrinth
107+ uses : Kir-Antipov/mc-publish@v3.3
93108 if : steps.check_mod_folder.outputs.files_exists == 'true'
94- env :
95- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
96109 with :
97- upload_url : ${{ steps.create_release.outputs.upload_url }}
98- asset_path : ./mod.zip
99- asset_name : ${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-mod.jar
100- asset_content_type : application/jar
101- - name : Upload assetpack release asset
102- uses : actions/upload-release-asset@v1
103- if : steps.check_assets_folder.outputs.files_exists == 'true'
104- env :
105- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
110+ modrinth-id : zrzYrlm0
111+ modrinth-token : ${{ secrets.MODRINTH_TOKEN }}
112+ game-versions : ${{ github.event.inputs.mc_version_range }}
113+ game-version-filter : any
114+ fail-mode : skip
115+
116+ name : " [Mod] Release v${{ github.event.inputs.tag }}"
117+ version : ${{ github.event.inputs.tag }}+mod
118+ changelog-file : CHANGES.md
119+
120+ dependencies : |
121+ fabric-api(optional){modrinth:P7dR8mSH}
122+ modmenu(optional){modrinth:mOgUt4GM}
123+ modmenu-badges-lib(optional){modrinth:eUw8l2Vi}
124+ midnightlib(optional){modrinth:codAaoxh}
125+ loaders : |
126+ fabric
127+ forge
128+ quilt
129+ files : |
130+ ./${{ github.event.repository.name }}-*-mod.jar
131+
132+ - name : Upload data pack version to CurseForge
133+ uses : Kir-Antipov/mc-publish@v3.3
134+ if : steps.check_datapack_folder.outputs.files_exists == 'true'
135+ with :
136+ curseforge-id : 811803
137+ curseforge-token : ${{ secrets.CURSEFORGE_TOKEN }}
138+ game-versions : ${{ github.event.inputs.mc_version_range }}
139+ game-version-filter : any
140+ fail-mode : skip
141+
142+ name : " Release v${{ github.event.inputs.tag }}"
143+ version : ${{ github.event.inputs.tag }}
144+ changelog-file : CHANGES.md
145+
146+ loaders : |
147+ datapack
148+ files : |
149+ ./${{ github.event.repository.name }}-*.zip
150+
151+ # - name: Upload mod version to CurseForge
152+ # uses: Kir-Antipov/mc-publish@v3.3
153+ # if: steps.check_mod_folder.outputs.files_exists == 'true'
154+ # with:
155+ # curseforge-id: 910095
156+ # curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
157+ # game-versions: ${{ github.event.inputs.mc_version_range }}
158+ # game-version-filter: any
159+ # fail-mode: skip
160+
161+ # name: "Release v${{ github.event.inputs.tag }}"
162+ # version: ${{ github.event.inputs.tag }}+mod
163+ # changelog-file: CHANGES.md
164+
165+ # dependencies: |
166+ # catalogue(optional){curseforge:459701}
167+ # catalogue-fabric(optional){curseforge:667377}
168+ # midnightlib(optional){curseforge:488090}
169+ # java: |
170+ # Java 21
171+ # Java 17
172+ # Java 18
173+ # loaders: |
174+ # fabric
175+ # forge
176+ # quilt
177+ # files: |
178+ # ./${{ github.event.repository.name }}-*-mod.jar
179+
180+ - name : Add changelog header for GitHub release
181+ run : sed -i '1i_Changelog:_' CHANGES.md
182+ - name : Upload outputs to GitHub releases
183+ uses : Kir-Antipov/mc-publish@v3.3
106184 with :
107- upload_url : ${{ steps.create_release.outputs.upload_url }}
108- asset_path : ./assetpack.zip
109- asset_name : ${{ github.event.repository.name }}-v${{ github.event.inputs.tag }}-mc${{ github.event.inputs.mc_version }}-resourcepack.zip
110- asset_content_type : application/zip
185+ github-token : ${{ secrets.GITHUB_TOKEN }}
186+ github-tag : v${{ github.event.inputs.tag }}
187+ game-versions : ${{ github.event.inputs.mc_version_range }}
188+
189+ name : Release v${{ github.event.inputs.tag }}
190+ version : v${{ github.event.inputs.tag }}
191+ changelog-file : CHANGES.md
192+
193+ files : |
194+ ./${{ github.event.repository.name }}-*.@(zip|jar)
0 commit comments