Skip to content

Commit

Permalink
Migrate to GTCEu Buildscripts (#48)
Browse files Browse the repository at this point in the history
* start

* massive skill issue

* update gha

* update buildscript

* setup publishing via gradle

* convert to java 17 syntax

* remove old properties

* remove file name var
  • Loading branch information
brachy84 committed Dec 16, 2023
1 parent a166248 commit 3bc60b8
Show file tree
Hide file tree
Showing 49 changed files with 1,726 additions and 493 deletions.
69 changes: 34 additions & 35 deletions .github/workflows/build_and_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ on:
- 'release'
- 'beta'
- 'alpha'
publish-cf-mr:
description: Publish to CF / MR
publish-cf:
description: Publish to CF
default: true
type: boolean
publish-mr:
description: Publish to MR
default: true
type: boolean
publish-gh:
Expand All @@ -37,6 +41,9 @@ on:
required: true
type: boolean

env:
CHANGELOG_LOCATION: "build/gh_changelog.md"

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -68,7 +75,7 @@ jobs:
fi
echo "publish-gh=${{ inputs.publish-gh }}" >> $GITHUB_ENV
else
if [ "${{ inputs.publish-cf-mr }}" == "true" ]; then
if [ "${{ inputs.publish-cf }}" == "true" ] || [ "${{ inputs.publish-mr }}" == "true" ]; then
echo "publish-gh=true" >> $GITHUB_ENV
else
echo "publish-gh=${{ inputs.publish-gh }}" >> $GITHUB_ENV
Expand All @@ -77,7 +84,7 @@ jobs:
- name: Set version
if: env.UPDATED == 'false' # only change new version if it's not already updated
run: sed -i "s/mod_version.*=.*/mod_version = ${{ github.event.inputs.version }}/g" gradle.properties
run: sed -i "s/modVersion.*=.*/modVersion = ${{ github.event.inputs.version }}/g" gradle.properties

- name: Commit and push gradle.properties
if: env.UPDATED == 'false' # only push new version if it's not already updated
Expand Down Expand Up @@ -126,46 +133,38 @@ jobs:
RELEASE_JSON=$(curl -sSL $RELEASE_URL)
CHANGELOG="$(echo $RELEASE_JSON | jq -r '.body')"
if [ "$CHANGELOG" == "null" ]; then
echo "No changelog found" > build/changelog.md
echo "No changelog found" > $CHANGELOG_LOCATION
else
echo "$CHANGELOG" > build/changelog.md
echo "$CHANGELOG" > $CHANGELOG_LOCATION
fi
- name: Publish Minecraft Mods
if: ${{ inputs.publish-cf-mr }}
uses: Kir-Antipov/[email protected]
- name: Publish to Curseforge
if: env.publish-cf == 'true'
uses: gradle/gradle-build-action@v2
env:
CURSEFORGE_API_KEY: "${{ secrets.CURSEFORGE_TOKEN }}"
CHANGELOG_LOCATION: $CHANGELOG_LOCATION
RELEASE_TYPE: "${{ inputs.release-type }}"
with:
arguments: 'curseforge'
generate-job-summary: false

- name: Publish to Modrinth
if: env.publish-mr == 'true'
uses: gradle/gradle-build-action@v2
env:
MODRINTH_API_KEY: "${{ secrets.MODRINTH_TOKEN }}"
CHANGELOG_LOCATION: $CHANGELOG_LOCATION
RELEASE_TYPE: "${{ inputs.release-type }}"
with:
curseforge-id: 624243
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}

modrinth-id: Ecvd12QC
modrinth-featured: true
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

files-primary: build/libs/!(*-@(dev|sources|javadoc)).jar
files-secondary: build/libs/*-@(dev|sources|javadoc).jar
name: "${GITHUB_REPOSITORY#*/}-${{ github.event.inputs.version }}"
version: ${{ github.event.inputs.version }}
version-type: ${{ github.event.inputs.release-type }}
changelog-file: build/changelog.md
loaders: |
forge
game-versions: |
1.12.2
dependencies: |
[email protected](required)
jei(optional)
hei(optional)
blur(optional)
java: |
8
retry-attempts: 2
arguments: 'modrinth'
generate-job-summary: false

- name: Publish to maven
if: ${{ inputs.publish-maven }}
uses: gradle/gradle-build-action@v2
with:
arguments: publish
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_NAME }}
MAVEN_USER: ${{ secrets.MAVEN_NAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
Loading

0 comments on commit 3bc60b8

Please sign in to comment.