-
Notifications
You must be signed in to change notification settings - Fork 17
219 lines (216 loc) · 7.39 KB
/
gradle-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
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
name: release
on:
workflow_dispatch:
inputs:
RELEASE_TYPE:
description: 'Release Type'
required: true
default: 'alpha'
MOD_VERSION:
description: 'Mod Version'
required: true
default: '2.2.0'
env:
MINECRAFT_VERSION: 1.19.2
JAVA_VERSION: 17
jobs:
changelog:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{env.MINECRAFT_VERSION}}-${{inputs.MOD_VERSION}}"
release_name: "${{env.MINECRAFT_VERSION}}-${{inputs.MOD_VERSION}}"
body: |
See CHANGELOG.md for history of changes
draft: false
prerelease: false
- name: Get previous tag
id: previousTag
run: |
name=$(git --no-pager tag --sort=creatordate --merged v${{env.MINECRAFT_VERSION}}-${{inputs.MOD_VERSION}} | tail -2 | head -1)
echo "previousTag: $name"
echo "previousTag=$name" >> $GITHUB_ENV
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: "v${{env.MINECRAFT_VERSION}}-${{inputs.MOD_VERSION}}"
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: update changelog"
- run: echo "${{ steps.changelog.outputs.changes }}" >> CHANGES.md
- name: Upload Changelog
uses: actions/upload-artifact@v4
with:
name: "changes"
path: |
CHANGES.md
retention-days: 1
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check Environment Variables
run: env
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: "temurin"
java-version: "${{ env.JAVA_VERSION }}"
- name: Build with Gradle
run: "chmod +x gradlew && ./gradlew clean build"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: "build"
path: |
fabric/build/libs/*.jar
forge/build/libs/*.jar
common/build/libs/*.jar
retention-days: 1
github:
needs: [build, changelog]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: true
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: "build"
path: build/
- name: Release the new binaries
uses: mini-bomba/[email protected]
with:
token: ${{ secrets.PUBLISH_GITHUB_TOKEN }}
tag: "latest"
name: "Latest Commit, that compiles"
files: |
build/fabric/build/libs/*.jar
build/forge/build/libs/*.jar
build/common/build/libs/*.jar
clear_attachments: true
modrinth:
needs: [build, changelog]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: "build"
path: build/
- name: Download changelog
uses: actions/download-artifact@v4
with:
name: "changes"
path: changes/
- name: Publish Fabric
uses: Kir-Antipov/[email protected]
with:
name: "strawgolem-${{inputs.MOD_VERSION}}-${{env.MINECRAFT_VERSION}}-${{inputs.RELEASE_TYPE}}"
modrinth-id: sXMCPogN
modrinth-token: ${{ secrets.PUBLISH_MODRINTH_TOKEN }}
changelog-file: changes/CHANGES.md
version: "${{inputs.MOD_VERSION}}"
version-type: "${{inputs.RELEASE_TYPE}}"
loaders: |
fabric
quilt
game-versions: "${{env.MINECRAFT_VERSION}}"
java: "${{env.JAVA_VERSION}}"
files: |
build/fabric/build/libs/!(*-@(sources)).jar
build/fabric/build/libs/*-@(sources).jar
build/common/build/libs/!(*-@(sources)).jar
build/common/build/libs/*-@(sources).jar
- name: Publish Forge
uses: Kir-Antipov/[email protected]
with:
name: "strawgolem-${{inputs.MOD_VERSION}}-${{env.MINECRAFT_VERSION}}-${{inputs.RELEASE_TYPE}}"
modrinth-id: sXMCPogN
modrinth-token: ${{ secrets.PUBLISH_MODRINTH_TOKEN }}
changelog-file: changes/CHANGES.md
version: "${{inputs.MOD_VERSION}}"
version-type: "${{inputs.RELEASE_TYPE}}"
loaders: forge
game-versions: "${{env.MINECRAFT_VERSION}}"
java: "${{env.JAVA_VERSION}}"
files: |
build/forge/build/libs/!(*-@(sources|slim)).jar
build/forge/build/libs/*-@(sources).jar
curseforge:
needs: [build, changelog]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: "build"
path: build/
- name: Download changelog
uses: actions/download-artifact@v4
with:
name: "changes"
path: changes/
- name: Publish Fabric
uses: Kir-Antipov/[email protected]
with:
name: "strawgolem-${{inputs.MOD_VERSION}}-${{env.MINECRAFT_VERSION}}-${{inputs.RELEASE_TYPE}}"
curseforge-id: 449768
curseforge-token: ${{ secrets.PUBLISH_CURSEFORGE_TOKEN }}
changelog-file: changes/CHANGES.md
version: "${{inputs.MOD_VERSION}}"
version-type: "${{inputs.RELEASE_TYPE}}"
loaders: |
fabric
quilt
game-versions: "${{env.MINECRAFT_VERSION}}"
java: "${{env.JAVA_VERSION}}"
files: |
build/fabric/build/libs/!(*-@(sources)).jar
build/fabric/build/libs/*-@(sources).jar
build/common/build/libs/!(*-@(sources)).jar
build/common/build/libs/*-@(sources).jar
- name: Publish Forge
uses: Kir-Antipov/[email protected]
with:
name: "strawgolem-${{inputs.MOD_VERSION}}-${{env.MINECRAFT_VERSION}}-${{inputs.RELEASE_TYPE}}"
curseforge-id: 387580
curseforge-token: ${{ secrets.PUBLISH_CURSEFORGE_TOKEN }}
changelog-file: changes/CHANGES.md
version: "${{inputs.MOD_VERSION}}"
version-type: "${{inputs.RELEASE_TYPE}}"
loaders: forge
game-versions: "${{env.MINECRAFT_VERSION}}"
java: "${{env.JAVA_VERSION}}"
files: |
build/forge/build/libs/!(*-@(sources|slim)).jar
build/forge/build/libs/*-@(sources).jar