Skip to content

Commit 3bc60b8

Browse files
authored
Migrate to GTCEu Buildscripts (#48)
* start * massive skill issue * update gha * update buildscript * setup publishing via gradle * convert to java 17 syntax * remove old properties * remove file name var
1 parent a166248 commit 3bc60b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1726
-493
lines changed

.github/workflows/build_and_publish.yaml

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@ on:
1919
- 'release'
2020
- 'beta'
2121
- 'alpha'
22-
publish-cf-mr:
23-
description: Publish to CF / MR
22+
publish-cf:
23+
description: Publish to CF
24+
default: true
25+
type: boolean
26+
publish-mr:
27+
description: Publish to MR
2428
default: true
2529
type: boolean
2630
publish-gh:
@@ -37,6 +41,9 @@ on:
3741
required: true
3842
type: boolean
3943

44+
env:
45+
CHANGELOG_LOCATION: "build/gh_changelog.md"
46+
4047
jobs:
4148
build:
4249
runs-on: ubuntu-latest
@@ -68,7 +75,7 @@ jobs:
6875
fi
6976
echo "publish-gh=${{ inputs.publish-gh }}" >> $GITHUB_ENV
7077
else
71-
if [ "${{ inputs.publish-cf-mr }}" == "true" ]; then
78+
if [ "${{ inputs.publish-cf }}" == "true" ] || [ "${{ inputs.publish-mr }}" == "true" ]; then
7279
echo "publish-gh=true" >> $GITHUB_ENV
7380
else
7481
echo "publish-gh=${{ inputs.publish-gh }}" >> $GITHUB_ENV
@@ -77,7 +84,7 @@ jobs:
7784
7885
- name: Set version
7986
if: env.UPDATED == 'false' # only change new version if it's not already updated
80-
run: sed -i "s/mod_version.*=.*/mod_version = ${{ github.event.inputs.version }}/g" gradle.properties
87+
run: sed -i "s/modVersion.*=.*/modVersion = ${{ github.event.inputs.version }}/g" gradle.properties
8188

8289
- name: Commit and push gradle.properties
8390
if: env.UPDATED == 'false' # only push new version if it's not already updated
@@ -126,46 +133,38 @@ jobs:
126133
RELEASE_JSON=$(curl -sSL $RELEASE_URL)
127134
CHANGELOG="$(echo $RELEASE_JSON | jq -r '.body')"
128135
if [ "$CHANGELOG" == "null" ]; then
129-
echo "No changelog found" > build/changelog.md
136+
echo "No changelog found" > $CHANGELOG_LOCATION
130137
else
131-
echo "$CHANGELOG" > build/changelog.md
138+
echo "$CHANGELOG" > $CHANGELOG_LOCATION
132139
fi
133140
134-
- name: Publish Minecraft Mods
135-
if: ${{ inputs.publish-cf-mr }}
136-
uses: Kir-Antipov/mc-publish@v3.2
141+
- name: Publish to Curseforge
142+
if: env.publish-cf == 'true'
143+
uses: gradle/gradle-build-action@v2
144+
env:
145+
CURSEFORGE_API_KEY: "${{ secrets.CURSEFORGE_TOKEN }}"
146+
CHANGELOG_LOCATION: $CHANGELOG_LOCATION
147+
RELEASE_TYPE: "${{ inputs.release-type }}"
148+
with:
149+
arguments: 'curseforge'
150+
generate-job-summary: false
151+
152+
- name: Publish to Modrinth
153+
if: env.publish-mr == 'true'
154+
uses: gradle/gradle-build-action@v2
155+
env:
156+
MODRINTH_API_KEY: "${{ secrets.MODRINTH_TOKEN }}"
157+
CHANGELOG_LOCATION: $CHANGELOG_LOCATION
158+
RELEASE_TYPE: "${{ inputs.release-type }}"
137159
with:
138-
curseforge-id: 624243
139-
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
140-
141-
modrinth-id: Ecvd12QC
142-
modrinth-featured: true
143-
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
144-
145-
files-primary: build/libs/!(*-@(dev|sources|javadoc)).jar
146-
files-secondary: build/libs/*-@(dev|sources|javadoc).jar
147-
name: "${GITHUB_REPOSITORY#*/}-${{ github.event.inputs.version }}"
148-
version: ${{ github.event.inputs.version }}
149-
version-type: ${{ github.event.inputs.release-type }}
150-
changelog-file: build/changelog.md
151-
loaders: |
152-
forge
153-
game-versions: |
154-
1.12.2
155-
dependencies: |
156-
mixin-booter@8.3(required)
157-
jei(optional)
158-
hei(optional)
159-
blur(optional)
160-
java: |
161-
8
162-
retry-attempts: 2
160+
arguments: 'modrinth'
161+
generate-job-summary: false
163162

164163
- name: Publish to maven
165164
if: ${{ inputs.publish-maven }}
166165
uses: gradle/gradle-build-action@v2
167166
with:
168167
arguments: publish
169168
env:
170-
MAVEN_USERNAME: ${{ secrets.MAVEN_NAME }}
169+
MAVEN_USER: ${{ secrets.MAVEN_NAME }}
171170
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

0 commit comments

Comments
 (0)