-
Notifications
You must be signed in to change notification settings - Fork 11
190 lines (179 loc) · 9.68 KB
/
build_and_publish.yaml
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
name: Build and Publish
on:
push:
tags:
- 'alpha/v**'
- 'beta/v**'
- 'release/v**'
- 'test/v**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up OpenJDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: Get release type from github tag
id: get_release_type
uses: actions/github-script@v7
with:
github-token: ${{ secrets.RELEASE_NOTES_TOKEN }}
result-encoding: string
script: |
return '${{ github.ref }}'.match(/refs\/tags\/(.*)\/v((.*)-(.*))/)[1];
- name: Get file version from tag
id: get_version
uses: actions/github-script@v7
with:
github-token: ${{ secrets.RELEASE_NOTES_TOKEN }}
result-encoding: string
script: |
return '${{ github.ref }}'.match(/refs\/tags\/(.*)\/v((.*)-(.*))/)[4];
- name: Get main mc version from tag
id: get_mc_version
uses: actions/github-script@v7
with:
github-token: ${{ secrets.RELEASE_NOTES_TOKEN }}
result-encoding: string
script: |
return '${{ github.ref }}'.match(/refs\/tags\/(.*)\/v((.*)-(.*))/)[3];
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true
- name: Build
run: ./gradlew build
env:
MOD_VERSION: ${{ steps.get_version.outputs.result }}
- name: Update CHANGELOG
id: changelog
uses: klikli-dev/changelog-action@main
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
mcVersion: ${{ steps.get_mc_version.outputs.result }}
- name: Create Neo Release
id: create_neo_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: false
replacesArtifacts: false
name: modonomicon-${{ steps.get_mc_version.outputs.result }}-${{ steps.get_version.outputs.result }}-${{ steps.get_release_type.outputs.result }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
#tag: ${{ github.ref }}
artifacts: neo/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-neoforge-${{ steps.get_version.outputs.result }}.jar,neo/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-neoforge-${{ steps.get_version.outputs.result }}-slim.jar,neo/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-neoforge-${{ steps.get_version.outputs.result }}-sources.jar,common/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-common-${{ steps.get_version.outputs.result }}.jar,common/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-common-${{ steps.get_version.outputs.result }}-sources.jar
artifactContentType: application/java-archive
- name: Create Forge Release
id: create_forge_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: false
replacesArtifacts: false
name: modonomicon-${{ steps.get_mc_version.outputs.result }}-${{ steps.get_version.outputs.result }}-${{ steps.get_release_type.outputs.result }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
#tag: ${{ github.ref }}
artifacts: forge/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-forge-${{ steps.get_version.outputs.result }}.jar,forge/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-forge-${{ steps.get_version.outputs.result }}-slim.jar,forge/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-forge-${{ steps.get_version.outputs.result }}-sources.jar,common/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-common-${{ steps.get_version.outputs.result }}.jar,common/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-common-${{ steps.get_version.outputs.result }}-sources.jar
artifactContentType: application/java-archive
- name: Create Fabric Release
id: create_fabric_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: false
replacesArtifacts: false
name: modonomicon-${{ steps.get_mc_version.outputs.result }}-${{ steps.get_version.outputs.result }}-${{ steps.get_release_type.outputs.result }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
#tag: ${{ github.ref }}
artifacts: fabric/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-fabric-${{ steps.get_version.outputs.result }}.jar,fabric/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-fabric-${{ steps.get_version.outputs.result }}-sources.jar,common/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-common-${{ steps.get_version.outputs.result }}.jar,common/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-common-${{ steps.get_version.outputs.result }}-sources.jar
artifactContentType: application/java-archive
- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v5
if: ${{ steps.get_release_type.outputs.result != 'test' }}
with:
branch: version/1.21.1
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
file_pattern: CHANGELOG.md
- name: Upload Neo Version to Mod Platforms
uses: Kir-Antipov/[email protected]
if: ${{ steps.get_release_type.outputs.result != 'test' }}
with:
modrinth-id: 692GClaE
modrinth-token: ${{ secrets.MODRINTH_API_KEY }}
curseforge-id: 538392
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}
files: |
neo/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-neoforge-${{ steps.get_version.outputs.result }}.jar
neo/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-neoforge-${{ steps.get_version.outputs.result }}-sources.jar
name: modonomicon-${{ steps.get_mc_version.outputs.result }}-neoforge-${{ steps.get_version.outputs.result }}.jar
version: ${{ steps.get_mc_version.outputs.result }}-${{ steps.get_version.outputs.result }}
version-type: ${{ steps.get_release_type.outputs.result }}
loaders: |
neoforge
game-versions: |
${{ steps.get_mc_version.outputs.result }}
changelog: |-
${{ steps.changelog.outputs.changes }}
Find changes for all versions at https://github.com/klikli-dev/modonomicon/releases
dependencies: |
jei(optional)
- name: Upload Forge Version to Mod Platforms
uses: Kir-Antipov/[email protected]
if: ${{ steps.get_release_type.outputs.result != 'test' }}
with:
modrinth-id: 692GClaE
modrinth-token: ${{ secrets.MODRINTH_API_KEY }}
curseforge-id: 538392
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}
files: |
forge/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-forge-${{ steps.get_version.outputs.result }}.jar
forge/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-forge-${{ steps.get_version.outputs.result }}-sources.jar
name: modonomicon-${{ steps.get_mc_version.outputs.result }}-forge-${{ steps.get_version.outputs.result }}.jar
version: ${{ steps.get_mc_version.outputs.result }}-${{ steps.get_version.outputs.result }}
version-type: ${{ steps.get_release_type.outputs.result }}
loaders: |
forge
game-versions: |
${{ steps.get_mc_version.outputs.result }}
changelog: |-
${{ steps.changelog.outputs.changes }}
Find changes for all versions at https://github.com/klikli-dev/modonomicon/releases
dependencies: |
jei(optional)
- name: Upload Fabric Version to Mod Platforms
uses: Kir-Antipov/[email protected]
if: ${{ steps.get_release_type.outputs.result != 'test' }}
with:
modrinth-id: 692GClaE
modrinth-token: ${{ secrets.MODRINTH_API_KEY }}
curseforge-id: 538392
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}
files: |
fabric/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-fabric-${{ steps.get_version.outputs.result }}.jar
fabric/build/libs/modonomicon-${{ steps.get_mc_version.outputs.result }}-fabric-${{ steps.get_version.outputs.result }}-sources.jar
name: modonomicon-${{ steps.get_mc_version.outputs.result }}-fabric-${{ steps.get_version.outputs.result }}.jar
version: ${{ steps.get_mc_version.outputs.result }}-${{ steps.get_version.outputs.result }}
version-type: ${{ steps.get_release_type.outputs.result }}
game-versions: |
${{ steps.get_mc_version.outputs.result }}
changelog: |-
${{ steps.changelog.outputs.changes }}
Find changes for all versions at https://github.com/klikli-dev/modonomicon/releases
dependencies: |
jei(optional)
# Publish at the end because it creates a non reobfed jarjar which otherwise would be distributed
- name: Publish
run: ./gradlew publish
if: ${{ steps.get_release_type.outputs.result != 'test' }}
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
MOD_VERSION: ${{ steps.get_version.outputs.result }}