Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions .github/workflows/pr-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,11 @@ jobs:
name: Gradle Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
java-version: 11
- uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-caches-
- uses: eskatos/gradle-command-action@v1
java-version: 17
distribution: temurin
- uses: gradle/gradle-build-action@v2
with:
arguments: build
15 changes: 8 additions & 7 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,28 @@ jobs:
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
java-version: 11
java-version: 17
distribution: temurin
- name: Gradle Build
uses: eskatos/gradle-command-action@v1
uses: gradle/gradle-build-action@v2
with:
arguments: build
- name: Extract version
uses: frabert/replace-string-action@master
uses: frabert/replace-string-action@v2.0
id: format-version
with:
pattern: 'refs/tags/release-([0-9]+.[0-9]+.[0-9]+)'
string: ${{ github.ref }}
replace-with: '$1'
- name: Release
uses: docker://antonyurchenko/git-release:v3
uses: docker://antonyurchenko/git-release:v4.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRAFT_RELEASE: "true"
ALLOW_TAG_PREFIX: "true"
TAG_PREFIX_REGEX: "release-"
with:
args: |
build/libs/simplenpcs-${{ steps.format-version.outputs.replaced }}.jar
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## [Unreleased]
### Changed
- Update gradle to 7.4
- Update to Spigot/MC 1.18
- Update to Java 17

## [0.1.0] - 2020-02-16
### Added
Expand All @@ -10,4 +14,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

[Unreleased]: https://github.com/SimpleMC/SimpleNPCs/compare/release-0.1.0...HEAD
[0.1.0]: https://github.com/SimpleMC/SimpleNPCs/releases/tag/release-0.1.0
[0.1.0]: https://github.com/SimpleMC/SimpleNPCs/releases/tag/release-0.1.0
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Simple "NPC" interaction plugin for binding commands to entities
## Features

- Simple, composable entity interactions via command binding
- Anything that can be done via a command can be easily turned into an NPC interaction

## Config Overview
```yaml
Expand Down
127 changes: 62 additions & 65 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,80 +6,77 @@ import java.time.ZoneOffset
import java.time.format.DateTimeFormatter

plugins {
kotlin("jvm") version "1.3.61"
id("com.github.johnrengelman.shadow") version "5.2.0"
id("pl.allegro.tech.build.axion-release") version "1.10.3"
id("org.jlleitschuh.gradle.ktlint") version "9.1.1"
kotlin("jvm") version "1.6.10"
id("com.github.johnrengelman.shadow") version "7.1.2"
id("pl.allegro.tech.build.axion-release") version "1.13.6"
id("org.jlleitschuh.gradle.ktlint") version "10.2.1"
}

val repoRef = "SimpleMC\\/SimpleNPCs"
val mcApiVersion = "1.15"
val mcApiVersion = "1.18"

group = "org.simplemc"
version = scmVersion.version

scmVersion {
hooks(closureOf<HooksConfig> {
pre(
"fileUpdate",
mapOf(
"file" to "src/main/resources/plugin.yml",
"pattern" to KotlinClosure2<String, HookContext, String>({ v, _ -> "version: $v\\napi-version: \".+\"" }),
"replacement" to KotlinClosure2<String, HookContext, String>({ v, _ -> "version: $v\napi-version: \"$mcApiVersion\"" })
)
)
// "normal" changelog update--changelog already contains a history
pre(
"fileUpdate",
mapOf(
"file" to "CHANGELOG.md",
"pattern" to KotlinClosure2<String, HookContext, String>({ v, _ ->
"\\[Unreleased\\]([\\s\\S]+?)\\n(?:^\\[Unreleased\\]: https:\\/\\/github\\.com\\/$repoRef\\/compare\\/release-$v\\.\\.\\.HEAD\$([\\s\\S]*))?\\z"
}),
"replacement" to KotlinClosure2<String, HookContext, String>({ v, c ->
"""
\[Unreleased\]

## \[$v\] - ${currentDateString()}$1
\[Unreleased\]: https:\/\/github\.com\/$repoRef\/compare\/release-$v...HEAD
\[$v\]: https:\/\/github\.com\/$repoRef\/compare\/release-${c.previousVersion}...release-$v$2
""".trimIndent()
})
versionIncrementer("incrementMinorIfNotOnRelease", mapOf("releaseBranchPattern" to "release/.+"))

hooks(
closureOf<HooksConfig> {
// "normal" changelog update--changelog already contains a history
pre(
"fileUpdate",
mapOf(
"file" to "CHANGELOG.md",
"pattern" to KotlinClosure2<String, HookContext, String>({ v, _ ->
"\\[Unreleased\\]([\\s\\S]+?)\\n(?:^\\[Unreleased\\]: https:\\/\\/github\\.com\\/$repoRef\\/compare\\/release-$v\\.\\.\\.HEAD\$([\\s\\S]*))?\\z"
}),
"replacement" to KotlinClosure2<String, HookContext, String>({ v, c ->
"""
\[Unreleased\]

## \[$v\] - ${currentDateString()}$1
\[Unreleased\]: https:\/\/github\.com\/$repoRef\/compare\/release-$v...HEAD
\[$v\]: https:\/\/github\.com\/$repoRef\/compare\/release-${c.previousVersion}...release-$v$2
""".trimIndent()
})
)
)
)
// first-time changelog update--changelog has only unreleased info
pre(
"fileUpdate",
mapOf(
"file" to "CHANGELOG.md",
"pattern" to KotlinClosure2<String, HookContext, String>({ v, _ ->
"Unreleased([\\s\\S]+?\\nand this project adheres to \\[Semantic Versioning\\]\\(https:\\/\\/semver\\.org\\/spec\\/v2\\.0\\.0\\.html\\).)\\s\\z"
}),
"replacement" to KotlinClosure2<String, HookContext, String>({ v, c ->
"""
\[Unreleased\]

## \[$v\] - ${currentDateString()}$1

\[Unreleased\]: https:\/\/github\.com\/$repoRef\/compare\/release-$v...HEAD
\[$v\]: https:\/\/github\.com\/$repoRef\/releases\/tag\/release-$v
""".trimIndent()
})
// first-time changelog update--changelog has only unreleased info
pre(
"fileUpdate",
mapOf(
"file" to "CHANGELOG.md",
"pattern" to KotlinClosure2<String, HookContext, String>({ _, _ ->
"Unreleased([\\s\\S]+?\\nand this project adheres to \\[Semantic Versioning\\]\\(https:\\/\\/semver\\.org\\/spec\\/v2\\.0\\.0\\.html\\).)\\s\\z"
}),
"replacement" to KotlinClosure2<String, HookContext, String>({ v, _ ->
"""
\[Unreleased\]
## \[$v\] - ${currentDateString()}$1
\[Unreleased\]: https:\/\/github\.com\/$repoRef\/compare\/release-$v...HEAD
\[$v\]: https:\/\/github\.com\/$repoRef\/releases\/tag\/release-$v
""".trimIndent()
})
)
)
)
pre("commit")
})
pre("commit")
}
)
}

fun currentDateString() = OffsetDateTime.now(ZoneOffset.UTC).toLocalDate().format(DateTimeFormatter.ISO_DATE)

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

repositories {
jcenter()
mavenCentral()
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://oss.sonatype.org/content/repositories/snapshots")
}
Expand All @@ -89,20 +86,20 @@ dependencies {
compileOnly(group = "org.spigotmc", name = "spigot-api", version = "$mcApiVersion+")
}

ktlint {
// FIXME - ktlint bug(?): https://github.com/pinterest/ktlint/issues/527
disabledRules.set(listOf("import-ordering"))
}

tasks {
wrapper {
gradleVersion = "6.1.1"
gradleVersion = "7.4.1"
distributionType = Wrapper.DistributionType.ALL
}

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
processResources {
val placeholders = mapOf(
"version" to version,
"apiVersion" to mcApiVersion
)

filesMatching("plugin.yml") {
expand(placeholders)
}
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading