mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 11:45:19 +01:00
build: Overhaul build & deployment workflow (#3267)
* Fixes #3250 * build: Overhaul build & deployment workflow - Move to release drafter - Replace publishing with gradle nexus - Conventional commits are handy - Determine build status in gh actions before deploying
This commit is contained in:
parent
e322ee85fd
commit
21727ebfc7
@ -1008,6 +1008,6 @@ ij_html_uniform_ident = false
|
||||
indent_size = 2
|
||||
ij_yaml_keep_indents_on_empty_lines = false
|
||||
ij_yaml_keep_line_breaks = true
|
||||
ij_yaml_space_before_colon = true
|
||||
ij_yaml_space_before_colon = false
|
||||
ij_yaml_spaces_within_braces = true
|
||||
ij_yaml_spaces_within_brackets = true
|
||||
|
20
.github/release-drafter.yml
vendored
Normal file
20
.github/release-drafter.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
categories:
|
||||
- title: '🐛 Fixes'
|
||||
label: 'Bugfix'
|
||||
- title: '✨ Features'
|
||||
label: 'Feature'
|
||||
- title: '🧭 Changes'
|
||||
label: 'Enhancement'
|
||||
- title: '📦 Dependency updates'
|
||||
labels:
|
||||
- 'Renovate'
|
||||
- 'Dependency updates'
|
||||
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
|
||||
change-title-escapes: '\<*_&@'
|
||||
exclude-contributors:
|
||||
- 'renovate'
|
||||
- 'renovate-bot'
|
||||
template: |
|
||||
## PlotSquared v6.
|
||||
|
||||
$CHANGES
|
26
.github/workflows/build.yml
vendored
26
.github/workflows/build.yml
vendored
@ -1,6 +1,6 @@
|
||||
name: "build"
|
||||
|
||||
on: ["pull_request", "push"]
|
||||
on: [ "pull_request", "push" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -8,6 +8,8 @@ jobs:
|
||||
steps:
|
||||
- name: "Checkout Repository"
|
||||
uses: "actions/checkout@v2.3.4"
|
||||
- name: "Validate Gradle Wrapper"
|
||||
uses: "gradle/wrapper-validation-action@v1.0.4"
|
||||
- name: "Setup JDK 16"
|
||||
uses: "actions/setup-java@v2.2.0"
|
||||
with:
|
||||
@ -15,3 +17,25 @@ jobs:
|
||||
java-version: "16"
|
||||
- name: "Clean Build"
|
||||
run: "./gradlew clean build"
|
||||
- name: "Determine release status"
|
||||
if: "${{ runner.os == 'Linux' }}"
|
||||
run: |
|
||||
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
|
||||
echo "STATUS=snapshot" >> $GITHUB_ENV
|
||||
else
|
||||
echo "STATUS=release" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: "Publish Release"
|
||||
if: "${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}"
|
||||
run: "./gradlew publishToSonatype closeSonatypeStagingRepository"
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
|
||||
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
|
||||
ORG_GRADLE_PROJECT_signingKey: "${{ secrets.SIGNING_KEY }}"
|
||||
ORG_GRADLE_PROJECT_signingPassword: "${{ secrets.SIGNING_PASSWORD }}"
|
||||
- name: "Publish Snapshot"
|
||||
if: "${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6' }}"
|
||||
run: "./gradlew publishToSonatype"
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
|
||||
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
|
||||
|
14
.github/workflows/release-drafter.yml
vendored
Normal file
14
.github/workflows/release-drafter.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
name: "draft release"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- v6
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
runs-on: "ubuntu-latest"
|
||||
steps:
|
||||
- uses: "release-drafter/release-drafter@v5.15.0"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
12
.github/workflows/validate-gradle-wrapper.yml
vendored
12
.github/workflows/validate-gradle-wrapper.yml
vendored
@ -1,12 +0,0 @@
|
||||
name: "validate gradle wrapper"
|
||||
|
||||
on: ["pull_request", "push"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: "ubuntu-20.04"
|
||||
steps:
|
||||
- name: "Checkout Repository"
|
||||
uses: "actions/checkout@v2.3.4"
|
||||
- name: "Validate Gradle Wrapper"
|
||||
uses: "gradle/wrapper-validation-action@v1.0.4"
|
@ -6,3 +6,8 @@ If you are planning to commit any changes to the project, it would be highly app
|
||||
code style conventions. To make this easier we have provided settings that can be picked up by your IDE.
|
||||
|
||||
IntelliJ: Install the `EditorConfig` plugin. Now IntelliJ is able to pick up the provided `.editorconfig` file automatically.
|
||||
|
||||
### Committing
|
||||
|
||||
We are using [conventional commits](https://www.conventionalcommits.org/en/) to make commit messages more descriptive and
|
||||
generate changelogs based on them.
|
||||
|
@ -183,8 +183,6 @@
|
||||
"error.task_in_process": "<prefix><gold>Task is already running.</gold>",
|
||||
"titles.title_entered_plot": "<gold>Plot: <world>;<plot></gold>",
|
||||
"titles.title_entered_plot_sub": "<dark_aqua>Owned by <owner></dark_aqua>",
|
||||
"titles.prefix_greeting": "<gold><id></gold><gray>></gray>",
|
||||
"titles.prefix_farewell": "<gold><id></gold><gray>></gray>",
|
||||
"core.prefix": "<dark_gray>[</dark_gray><gold>P2</gold><dark_gray>] </dark_gray>",
|
||||
"core.enabled": "<prefix><gold><value> is now enabled.</gold>",
|
||||
"placeholder.hooked": "<prefix><gold>PlotSquared hooked into MVdWPlaceholderAPI</gold>",
|
||||
|
@ -1,6 +1,7 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
|
||||
import org.cadixdev.gradle.licenser.LicenseExtension
|
||||
import org.cadixdev.gradle.licenser.Licenser
|
||||
import java.net.URI
|
||||
|
||||
plugins {
|
||||
java
|
||||
@ -11,22 +12,13 @@ plugins {
|
||||
alias(libs.plugins.shadow)
|
||||
alias(libs.plugins.licenser)
|
||||
alias(libs.plugins.grgit)
|
||||
alias(libs.plugins.nexus)
|
||||
|
||||
eclipse
|
||||
idea
|
||||
}
|
||||
|
||||
var ver by extra("6.1.3")
|
||||
var versuffix by extra("-SNAPSHOT")
|
||||
val versionsuffix: String? by project
|
||||
if (versionsuffix != null) {
|
||||
versuffix = "-$versionsuffix"
|
||||
}
|
||||
version = if (!project.hasProperty("release")) {
|
||||
ver + versuffix
|
||||
} else {
|
||||
ver
|
||||
}
|
||||
version = "6.1.3-SNAPSHOT"
|
||||
|
||||
allprojects {
|
||||
group = "com.plotsquared"
|
||||
@ -103,6 +95,9 @@ allprojects {
|
||||
|
||||
signing {
|
||||
if (!version.toString().endsWith("-SNAPSHOT")) {
|
||||
val signingKey: String? by project
|
||||
val signingPassword: String? by project
|
||||
useInMemoryPgpKeys(signingKey, signingPassword)
|
||||
signing.isRequired
|
||||
sign(publishing.publications)
|
||||
}
|
||||
@ -111,8 +106,6 @@ allprojects {
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("maven") {
|
||||
// This includes not only the original jar (i.e. not shadowJar),
|
||||
// but also sources & javadocs due to the above java block.
|
||||
from(components["java"])
|
||||
|
||||
pom {
|
||||
@ -133,18 +126,23 @@ allprojects {
|
||||
developer {
|
||||
id.set("Sauilitired")
|
||||
name.set("Alexander Söderberg")
|
||||
organization.set("IntellectualSites")
|
||||
}
|
||||
developer {
|
||||
id.set("NotMyFault")
|
||||
name.set("NotMyFault")
|
||||
organization.set("IntellectualSites")
|
||||
email.set("contact@notmyfault.dev")
|
||||
}
|
||||
developer {
|
||||
id.set("SirYwell")
|
||||
name.set("Hannes Greule")
|
||||
organization.set("IntellectualSites")
|
||||
}
|
||||
developer {
|
||||
id.set("dordsor21")
|
||||
name.set("dordsor21")
|
||||
organization.set("IntellectualSites")
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,34 +159,6 @@ allprojects {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal() // Install to own local repository
|
||||
|
||||
// Accept String? to not err if they're not present.
|
||||
// Check that they both exist before adding the repo, such that
|
||||
// `credentials` doesn't err if one is null.
|
||||
// It's not pretty, but this way it can compile.
|
||||
val nexusUsername: String? by project
|
||||
val nexusPassword: String? by project
|
||||
if (nexusUsername != null && nexusPassword != null) {
|
||||
maven {
|
||||
val releasesRepositoryUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
|
||||
val snapshotRepositoryUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
|
||||
url = uri(
|
||||
if (version.toString().endsWith("-SNAPSHOT")) snapshotRepositoryUrl
|
||||
else releasesRepositoryUrl
|
||||
)
|
||||
|
||||
credentials {
|
||||
username = nexusUsername
|
||||
password = nexusPassword
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.warn("No nexus repository is added; nexusUsername or nexusPassword is null.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -217,10 +187,6 @@ allprojects {
|
||||
)
|
||||
}
|
||||
|
||||
jar {
|
||||
this.archiveClassifier.set("jar")
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
this.archiveClassifier.set(null as String?)
|
||||
this.archiveFileName.set("${project.name}-${project.version}.${this.archiveExtension.getOrElse("jar")}")
|
||||
@ -237,6 +203,15 @@ allprojects {
|
||||
|
||||
}
|
||||
|
||||
nexusPublishing {
|
||||
repositories {
|
||||
sonatype {
|
||||
nexusUrl.set(URI.create("https://s01.oss.sonatype.org/service/local/"))
|
||||
snapshotRepositoryUrl.set(URI.create("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
val aggregatedJavadocs = create<Javadoc>("aggregatedJavadocs") {
|
||||
title = "${project.name} ${project.version} API"
|
||||
|
@ -42,6 +42,7 @@ http4j = "1.3"
|
||||
shadow = "7.0.0"
|
||||
grgit = "4.1.0"
|
||||
licenser = "0.6.1"
|
||||
nexus = "1.1.0"
|
||||
|
||||
[libraries]
|
||||
# Platform expectations
|
||||
@ -92,3 +93,4 @@ paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref
|
||||
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
||||
grgit = { id = "org.ajoberstar.grgit", version.ref = "grgit" }
|
||||
licenser = { id = "org.cadixdev.licenser", version.ref = "licenser" }
|
||||
nexus = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus" }
|
||||
|
@ -12,5 +12,7 @@
|
||||
"timezone": "Europe/Berlin",
|
||||
"schedule": [
|
||||
"on monday after 9am"
|
||||
]
|
||||
],
|
||||
"labels": ["Renovate"],
|
||||
"commitMessagePrefix": "chore: "
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user