-
Notifications
You must be signed in to change notification settings - Fork 35
79 lines (67 loc) · 2.7 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
name: publish
on:
release:
types: [published]
jobs:
build:
name: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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@v3
with:
distribution: temurin
java-version: 17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ubuntu-latest-gradle-
- name: Build with Gradle
run: ./gradlew -PmodVersion='${{ steps.split_tag.outputs.mod_version }}' build
- name: Remove extra JARs
run: |
rm fabric/build/libs/*-dev-shadow.jar
rm forge/build/libs/*-dev-shadow.jar
- name: Add Artifacts to Github Release
uses: alexellis/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["./forge/build/libs/*.jar","./fabric/build/libs/*.jar","./common/build/libs/*-api.jar"]'
- name: Publish to Curseforge and Minotaur (Forge)
uses: Kir-Antipov/[email protected]
with:
name: ${{ github.event.repository.name }}-MC${{ steps.split_tag.outputs.mc_version }}-${{ steps.split_tag.outputs.mod_version }}
version: MC${{ steps.split_tag.outputs.mc_version }}-forge-${{ steps.split_tag.outputs.mod_version }}
java: Java 17
files: |
forge/build/libs/*.jar
common/build/libs/*-api.jar
modrinth-token: ${{ secrets.MODRINTH_API_KEY }}
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}
- name: Publish to Curseforge and Minotaur (Fabric)
uses: Kir-Antipov/[email protected]
with:
name: ${{ github.event.repository.name }}-MC${{ steps.split_tag.outputs.mc_version }}-${{ steps.split_tag.outputs.mod_version }}
version: MC${{ steps.split_tag.outputs.mc_version }}-fabric-${{ steps.split_tag.outputs.mod_version }}
java: Java 17
files: |
fabric/build/libs/*.jar
common/build/libs/*-api.jar
modrinth-token: ${{ secrets.MODRINTH_API_KEY }}
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}