-
Notifications
You must be signed in to change notification settings - Fork 35
94 lines (79 loc) · 2.84 KB
/
publish.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
name: publish
on:
release:
types: [ published ]
jobs:
build:
runs-on: ubuntu-latest
outputs:
mc_version: ${{ steps.split_tag.outputs.mc_version }}
mod_version: ${{ steps.split_tag.outputs.mod_version }}
steps:
- name: Extract Version from Tag
id: split_tag
run: |
tag=${{ github.event.release.tag_name }}
parts=(${tag//\// })
echo "mc_version=${parts[0]}" >> $GITHUB_OUTPUT
echo "mod_version=${parts[1]}" >> $GITHUB_OUTPUT
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ubuntu-latest-gradle-
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew -PmodVersion='${{ steps.split_tag.outputs.mod_version }}' build
- name: Remove shadow JARs
run: |
rm fabric/build/libs/*-dev-shadow.jar
rm forge/build/libs/*-dev-shadow.jar
rm neoforge/build/libs/*-dev-shadow.jar
- name: Add Artifacts to Github Release
uses: alexellis/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["./fabric/build/libs/*.jar","./forge/build/libs/*.jar","./neoforge/build/libs/*.jar","./common/build/libs/*-api.jar"]'
- uses: actions/upload-artifact@v4
name: Upload Artifacts
id: upload-artifacts
with:
name: jar-files
path: |
./common/build/libs/*-api.jar
./fabric/build/libs/*.jar
./forge/build/libs/*.jar
./neoforge/build/libs/*.jar
retention-days: 1
publish:
strategy:
matrix:
loader: [ fabric, forge, neoforge ]
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: jar-files
- name: Publish (${{ matrix.loader }})
uses: Kir-Antipov/[email protected]
with:
name: ${{ github.event.repository.name }}-MC${{ needs.build.outputs.mc_version }}-${{ needs.build.outputs.mod_version }}
version: MC${{ needs.build.outputs.mc_version }}-${{ matrix.loader }}-${{ needs.build.outputs.mod_version }}
java: Java 17
files: ${{ matrix.loader }}/build/libs/*.jar
modrinth-token: ${{ secrets.MODRINTH_API_KEY }}
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}