-
Notifications
You must be signed in to change notification settings - Fork 2
201 lines (167 loc) · 6.09 KB
/
release.yml
File metadata and controls
201 lines (167 loc) · 6.09 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: Publish on Modrinth & CurseForge
on:
workflow_dispatch:
secrets:
CURSEFORGE_TOKEN:
required: true
MODRINTH_TOKEN:
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Branch
uses: actions/checkout@v3
- name: Get Artifact Id
uses: actions/github-script@v5
env:
branch: ${{ github.head_ref || github.ref_name }}
id: artifact_id
with:
result-encoding: string
script: |
// use env branch replace / with _
return process.env.branch.replace(/\//g, '_')
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 21
- name: Grant Execute Permission
run: chmod +x gradlew
- name: Build
run: |
./gradlew build
- name: Upload To Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.artifact_id.outputs.result }}
path: |
./dist/**/*
./fabric/build/libs
./forge/build/libs
./gradle.properties
deploy:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout Branch
uses: actions/checkout@v3
- name: Get Artifact Id
uses: actions/github-script@v5
env:
branch: ${{ github.head_ref || github.ref_name }}
id: artifact_id
with:
result-encoding: string
script: |
// use env branch replace / with _
return process.env.branch.replace(/\//g, '_')
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 21
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: ${{ steps.artifact_id.outputs.result }}
- name: Load Gradle Properties
uses: christian-draeger/read-properties@1.1.1
id: gradle_properties
with:
path: './gradle.properties'
properties: 'java_version minecraft_version mod_version'
- name: Check For Fabric Jar
uses: actions/github-script@v5
id: fabric_release
with:
result-encoding: string
script: |
const fs = require("fs")
return fs.readdirSync("./fabric/build/libs")[0] || false;
- name: Check For Forge Jar
uses: actions/github-script@v5
id: forge_release
with:
result-encoding: string
script: |
const fs = require("fs")
return fs.readdirSync("./forge/build/libs")[0] || false;
- name: Run Publish Fabric
if: ${{ steps.fabric_release.outputs.result != 'false' }}
uses: Kir-Antipov/mc-publish@v3.3
id: publish_fabric
with:
modrinth-id: OI3FlFon
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: false
modrinth-unfeature-mode: any
curseforge-id: 1302303
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
name: ${{ steps.gradle_properties.outputs.mod_version }}+${{ steps.gradle_properties.outputs.minecraft_version }}-Fabric
version: ${{ steps.gradle_properties.outputs.mod_version }}
files: |
./fabric/build/libs/!(*-@(dev|sources|javadoc|all|dev-shadow)).jar
./fabric/build/libs/*-@(dev|sources|javadoc|all|dev-shadow).jar
version-type: release
loaders: fabric
game-versions: |
${{ steps.gradle_properties.outputs.minecraft_version }}
changelog-file: CHANGELOG.md
java: ${{ steps.gradle_properties.outputs.java_version }}
retry-attempts: 5
retry-delay: 60000
fail-mode: skip
- name: Run Publish Forge
if: ${{ steps.forge_release.outputs.result != 'false' }}
uses: Kir-Antipov/mc-publish@v3.3
id: publish_forge
with:
modrinth-id: OI3FlFon
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: false
modrinth-unfeature-mode: any
curseforge-id: 1302303
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
name: ${{ steps.gradle_properties.outputs.mod_version }}+${{ steps.gradle_properties.outputs.minecraft_version }}-NeoForge
version: ${{ steps.gradle_properties.outputs.mod_version }}
files: |
./forge/build/libs/!(*-@(dev|sources|javadoc|all|dev-shadow)).jar
./forge/build/libs/*-@(dev|sources|javadoc|all|dev-shadow).jar
version-type: release
loaders: neoforge
game-versions: |
${{ steps.gradle_properties.outputs.minecraft_version }}
changelog-file: CHANGELOG.md
java: ${{ steps.gradle_properties.outputs.java_version }}
retry-attempts: 5
retry-delay: 60000
fail-mode: skip
- name: Build P2D_LINKS
shell: bash
run: |
{
echo 'P2D_LINKS<<EOF'
# --- Fabric ---
if [ -n "${{ steps.publish_fabric.outputs.modrinth-url }}" ]; then
echo "Modrinth (Fabric)|${{ steps.publish_fabric.outputs.modrinth-url }}|MODRINTH"
fi
if [ -n "${{ steps.publish_fabric.outputs.curseforge-url }}" ]; then
echo "CurseForge (Fabric)|${{ steps.publish_fabric.outputs.curseforge-url }}|CURSEFORGE"
fi
echo ""
# --- NeoForge ---
if [ -n "${{ steps.publish_forge.outputs.modrinth-url }}" ]; then
echo "Modrinth (NeoForge)|${{ steps.publish_forge.outputs.modrinth-url }}|MODRINTH"
fi
if [ -n "${{ steps.publish_forge.outputs.curseforge-url }}" ]; then
echo "CurseForge (NeoForge)|${{ steps.publish_forge.outputs.curseforge-url }}|CURSEFORGE"
fi
echo 'EOF'
} >> "$GITHUB_ENV"
- name: Discord notify
run: ./gradlew publishToDiscord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}