Skip to content

Commit

Permalink
Merge pull request #3 from liplum/mgpp-v1.2
Browse files Browse the repository at this point in the history
Upgrade MGPP to v1.2
  • Loading branch information
liplum authored Jan 31, 2023
2 parents a3c1f51 + 963fc79 commit cbaf054
Show file tree
Hide file tree
Showing 12 changed files with 217 additions and 151 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/CleanUpTemplate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
template-cleanup:
name: Template Cleanup
runs-on: ubuntu-latest
if: github.event.repository.full_name != 'liplum/MdtModTemplate'
if: github.event.repository.full_name != 'liplum/MindustryModTemplate'
steps:
- name: Fetch Sources
uses: actions/[email protected]
Expand All @@ -18,7 +18,12 @@ jobs:
- name: Run Cleanup Script
env:
FULL_NAME: ${{ github.event.repository.full_name }}
run: python .github/workflows/cleanup/main.py "$FULL_NAME"
run: |
if [ -f cleanup.py ]; then
python cleanup.py "$FULL_NAME"
else
rm .github/workflows/CleanUpTemplate.yml
fi
# Commit modified files
- name: Commit files
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/PullRequest.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
name: Pull Request Testing

on: [ pull_request ]
on: pull_request

jobs:
buildJar:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up PATH
run: |
echo "${ANDROID_HOME}/build-tools/30.0.1" >> $GITHUB_PATH
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'

- name: Build mod jar
run: |
chmod +x gradlew
./gradlew deploy
- name: Upload Mod Jar
uses: actions/upload-artifact@v2
with:
Expand Down
23 changes: 1 addition & 22 deletions .github/workflows/Push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ jobs:
distribution: 'temurin'
cache: 'gradle'

- name: Get short commit hash
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Build Mod Jar
run: |
chmod +x gradlew
Expand All @@ -28,22 +25,4 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: Mod-Unzip-This
path: build/tmp/deploy/*.jar

release-draft:
needs: build
if: ${{ contains(github.event.head_commit.message,'[release]') }}
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
steps:
- uses: actions/checkout@v2

- uses: actions/download-artifact@v2
with:
name: Mod-Unzip-This
path: out
- name: Create Release Draft
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create new --draft out/*.jar
path: build/tmp/deploy/*.jar
30 changes: 30 additions & 0 deletions .github/workflows/ReleaseDraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Creat Release Draft
on: workflow_dispatch

jobs:
build:
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
steps:
- uses: actions/checkout@v2

- name: Set Android SDK tools
run: echo "$ANDROID_HOME/build-tools/30.0.3" >> $GITHUB_PATH

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'

- name: Build Mod Jar
run: |
chmod +x gradlew
./gradlew deploy
- name: Create Release Draft
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create new --draft build/tmp/deploy/*.jar
17 changes: 0 additions & 17 deletions .github/workflows/cleanup/README.md

This file was deleted.

83 changes: 0 additions & 83 deletions .github/workflows/cleanup/main.py

This file was deleted.

58 changes: 47 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,75 @@

# Mindustry Mod Template

This template utilized [MGPP gradle plugin](https://plumygame.github.io/mgpp/) to build and debug a mod.
#### *[MGPP](https://plumygames.github.io/mgpp/) helps you to build and debug a Java mod.*

</div>

___

It's recommended to `watch` this project, which will notify you anything updated of the template.

## How to use this template
## How To Use This Template

Hit the [green button](https://github.com/liplum/mdtmodtemplate/generate) `Use this template` above, not the `fork`, and enter your repository name, always the same as a mod name.
Above all, please take a look at the documentation of [MGPP](https://plumygames.github.io/mgpp/).
It'll help you to build your mod, run the Mindustry and debug your mod in game!

After the GitHub actions has done the clean-up job, you can clone your repository.
### GitHub Automation

There will be a generated `main class` and `mod.hjson`.
- Step 1: Hit the green button [Use this template](https://github.com/liplum/MindustryModTemplate/generate) above.
- Step 2: Enter your repository name, which is used to generate `mod.hjson`.
- Step 3: After GitHub Action has done the cleanup job, clone your repository.
```shell
git clone https://github.com/<your-name>/<your-repo>.git
```

### Manually Clone

- Step 1: Clone this template.
```shell
git clone https://github.com/liplum/MindustryModTemplate.git <your-mod-name>
```
- Step 2: Delete `.git` folder.
```shell
cd <your-mod-name>
rm -rf .git
```

You need [Python 3](https://www.python.org/) installed on your computer to run the cleanup script.
Otherwise, you can just delete the [cleanup.py](cleanup.py) file in the root folder.

Replace `<author>` to your name, `<your-mod-name>` to your mod name bellow, and run the command.

```shell
python cleanup.py "<author>/<your-mod-name>"
```

It will clean up your project and generate essential files.

## Building through GitHub Actions

Check the "Actions" tab on your repository page.
Select the most recent commit in the list.
Check the "Actions" tab on your repository page.
Select the most recent commit in the list.

If it completed successfully, there should be a download link under the "Artifacts" section,
that could work on both Desktop and Android.

## Generating release draft
Any push whose head commit contains `[release]` in its message, a release draft will be generated on GitHub.
## Create a Release Draft

- Step 1: Check the "Actions" tab on your repository page.
- Step 2: Find `Creat Release Draft` on the left hand.
- Step 3: Hit `Run workflow` button and run on a branch you want, mostly, it's `master`.
Then a release draft with a `.jar` file, it's your mod, will be generated on GitHub.

## Gradle DSL and Kotlin

You can select which `Gradle DSL` to use, by easily deleting `build.gradle` or `build.gradle.kts`.
You can select which `Gradle DSL` to use by easily deleting either `build.gradle` or `build.gradle.kts`.

If you kept both, it would use `build.gradle` as default.

If you want to make a Kotlin mod, please keep the `build.gradle.kts` and remove `build.gradle`.
If you want to make a Kotlin mod, please delete `build.gradle`.

## Licence

GNU General Public License v3.0
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "io.github.liplum.mgpp" version "1.1.10"
id "io.github.liplum.mgpp" version "1.2.0"
}

group 'org.example'
Expand All @@ -23,14 +23,14 @@ dependencies {
}
mindustry {
dependency {
mindustry version: 'v136'
arc version: 'v136.1'
mindustryMirror version: 'v141.2'
arc version: 'v141.3'
}
client {
official version: 'v136.1'
official version: 'v141.3'
}
server {
official version: 'v136.1'
official version: 'v141.3'
}
def name = project.archivesBaseName
deploy {
Expand Down
12 changes: 6 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import io.github.liplum.mindustry.*

plugins {
kotlin("jvm") version "1.7.0"
id("io.github.liplum.mgpp") version "1.1.10"
kotlin("jvm") version "1.8.0"
id("io.github.liplum.mgpp") version "1.2.0"
}

sourceSets {
Expand All @@ -28,14 +28,14 @@ dependencies {
}
mindustry {
dependency {
mindustry on "v136"
arc on "v136.1"
mindustry mirror "v141.2"
arc on "v141.3"
}
client {
mindustry official "v136.1"
mindustry official "v141.3"
}
server {
mindustry official "v136.1"
mindustry official "v141.3"
}
deploy {
baseName = project.name
Expand Down
Loading

0 comments on commit cbaf054

Please sign in to comment.