Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use reusable workflows and shared renovate config #119

Merged
merged 3 commits into from
Dec 10, 2023
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
21 changes: 10 additions & 11 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
changelog:
exclude:
categories:
- title: "Breaking changes :warning:"
- title: "⚠️ Breaking changes"
labels:
- "status: breaking"
- title: "Additions :sparkles:"
- title: "✨ Additions"
labels:
- "type: feature"
- "type: enhancement"
- title: "Bug fixes :bug:"
- title: "🐛 Fixes"
labels:
- "type: bug: fix"
- title: "Improvements :wrench:"
- title: "🔧 Improvements"
labels:
- "type: enhancement"
- "type: refactor"
- title: "Documentation :book:"
- "type: performance"
- "type: removal"
- title: "📖 Documentation"
labels:
- "type: documentation"
- title: "Test coverage :test_tube:"
- title: "🧪 Test coverage"
labels:
- "type: test"
- title: "Dependency updates"
labels:
- "type: dependencies"
- title: "Other"
- title: "⚙️ Other"
labels:
- "*"
15 changes: 0 additions & 15 deletions .github/renovate.json

This file was deleted.

6 changes: 6 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
extends: [
'github>HyperaDev/actions',
],
}
60 changes: 9 additions & 51 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,18 @@
# GitHub Action workflow to run Gradle tasks.
# GitHub Actions workflow to build a Gradle project.
name: "Gradle"

on:
push:
branches: [ "main" ]
branches: [ "main", "releases/**" ]
tags-ignore: ["**"]
pull_request:
branches: [ "main" ]
schedule:
- cron: "25 6 * * 5"

concurrency:
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
cancel-in-progress: true

env:
JAVA_VERSION: 17
merge_group:

jobs:
validate:
name: "Validate"
runs-on: "ubuntu-latest"
permissions: read-all
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Validate Gradle wrapper"
uses: gradle/wrapper-validation-action@v1

build:
name: "Build"
runs-on: "ubuntu-latest"
needs: "validate"
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
steps:
- name: "Checkout repository"
uses: actions/checkout@v3

- name: "Set up JDK ${{ env.JAVA_VERSION }}"
uses: actions/setup-java@v3
with:
java-version: "${{ env.JAVA_VERSION }}"
distribution: "adopt"

- name: "Build"
uses: gradle/gradle-build-action@v2
with:
arguments: "build"

- name: "Upload artifacts"
uses: actions/upload-artifact@v3
with:
retention-days: 14
if-no-files-found: ignore
path: build/libs/UltraStaffChat-*.jar
uses: HyperaDev/actions/.github/workflows/gradle-build.yml@main
with:
codecov_enabled: false
upload_artifacts: |
build/libs/UltraStaffChat-*.jar
57 changes: 0 additions & 57 deletions .github/workflows/publish.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# GitHub Actions workflow to publish releases.
# Releases are published from the 'releases/<major>' branches.
name: "Release"
on:
push:
branches: [ "releases/**" ]

jobs:
release:
name: "Release"
uses: HyperaDev/actions/.github/workflows/gradle-release.yml@main
secrets:
HYPERA_SIGNING_KEY: "${{ secrets.GPG_PRIVATE_KEY }}"
HYPERA_SIGNING_PASSWORD: "${{ secrets.GPG_PASSPHRASE }}"
HYPERA_RELEASES_USERNAME: "${{ secrets.HYPERA_RELEASES_USERNAME }}"
HYPERA_RELEASES_PASSWORD: "${{ secrets.HYPERA_RELEASES_PASSWORD }}"
with:
project_name: "UltraStaffChat"
release_files: |
build/libs/UltraStaffChat-*.jar
15 changes: 15 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# GitHub Actions workflow to publish unstable snapshots.
# Snapshots are published from the 'main' branch, and should always be considered
# unstable and unfit for production usage.
name: "Snapshot"
on:
push:
branches: [ "main" ]

jobs:
snapshot:
name: "Snapshot"
uses: HyperaDev/actions/.github/workflows/gradle-snapshot.yml@main
secrets:
HYPERA_SNAPSHOTS_USERNAME: "${{ secrets.HYPERA_SNAPSHOTS_USERNAME }}"
HYPERA_SNAPSHOTS_PASSWORD: "${{ secrets.HYPERA_SNAPSHOTS_PASSWORD }}"
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ indra {
ci(true)
}

signWithKeyFromPrefixedProperties("hypera")
publishReleasesTo("hyperaReleases", "https://repo.hypera.dev/releases")
publishSnapshotsTo("hyperaSnapshots", "https://repo.hypera.dev/snapshots")

Expand Down
11 changes: 0 additions & 11 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
@Suppress( // https://youtrack.jetbrains.com/issue/KTIJ-19369/
"DSL_SCOPE_VIOLATION",
"MISSING_DEPENDENCY_CLASS",
"UNRESOLVED_REFERENCE_WRONG_RECEIVER",
"FUNCTION_CALL_EXPECTED"
)
plugins {
id("ultrastaffchat.common")
alias(libs.plugins.indra.sonatype)
alias(libs.plugins.shadow)
java
}
Expand All @@ -48,10 +41,6 @@ dependencies {
compileOnly(libs.annotations)
}

indraSonatype {
useAlternateSonatypeOSSHost("s01")
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down
9 changes: 4 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "1.0"
[versions]
# Adventure
adventure = "4.14.0"
adventure-platform = "4.3.0"
adventure-platform = "4.3.1"

# Platforms
platform-bungeecord = "1.20-R0.1-SNAPSHOT"
Expand All @@ -14,11 +14,11 @@ updatelib = "4.0.0"
bstats = "3.0.2"

# Code safety
annotations = "24.0.1"
annotations = "24.1.0"

# Build
build-indra = "3.1.2"
build-errorprone = "2.20.0"
build-indra = "3.1.3"
build-errorprone = "2.23.0"
build-errorprone-plugin = "3.1.0"
build-shadow = "8.1.1"

Expand All @@ -45,5 +45,4 @@ build-errorprone-core = { module = "com.google.errorprone:error_prone_core", ver
build-errorprone-annotations = { module = "com.google.errorprone:error_prone_annotations", version.ref = "build-errorprone" }

[plugins]
indra-sonatype = { id = "net.kyori.indra.publishing.sonatype", version.ref = "build-indra" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "build-shadow" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
22 changes: 2 additions & 20 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
#
# This file is a part of UltraStaffChat (https://github.com/HyperaDev/UltraStaffChat).
#
# Copyright (C) 2021-2023 The UltraStaffChat Authors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
22 changes: 13 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -130,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -198,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down