From 414cd90619366e95a082bdae8bc021da06004c52 Mon Sep 17 00:00:00 2001 From: Callum Seabrook Date: Thu, 28 Sep 2023 12:00:46 +0100 Subject: [PATCH] Switch to common publish actions and upgrade to Java 21 --- .github/workflows/maven-development.yaml | 27 +++++-------------- .github/workflows/maven-release.yaml | 26 +++++------------- build.gradle.kts | 2 +- .../emortal/api/modules/ModuleManager.java | 2 +- 4 files changed, 14 insertions(+), 43 deletions(-) diff --git a/.github/workflows/maven-development.yaml b/.github/workflows/maven-development.yaml index d676fc8..a17caf4 100644 --- a/.github/workflows/maven-development.yaml +++ b/.github/workflows/maven-development.yaml @@ -1,27 +1,12 @@ -name: Publish to development (snapshot) repo +name: "Publish to development (snapshot) repo" + on: push jobs: publish: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" steps: - - uses: actions/checkout@v3 - - name: Get Commit Hash - id: commit - uses: pr-mpt/actions-commit-hash@v2 - - name: Set up Java - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'adopt' - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 - - name: Publish package - uses: gradle/gradle-build-action@ced6859e9c4c384100f94984814deb1bd361f648 + - uses: "emortalmc/actions/java/publish-dev@main" with: - arguments: publishMavenPublicationToDevelopmentRepository - env: - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_SECRET: ${{ secrets.MAVEN_SECRET }} - COMMIT_HASH: ${{ steps.commit.outputs.hash }} - COMMIT_HASH_SHORT: ${{ steps.commit.outputs.short }} + maven-username: "${{ secrets.MAVEN_USERNAME }}" + maven-password: "${{ secrets.MAVEN_SECRET }}" diff --git a/.github/workflows/maven-release.yaml b/.github/workflows/maven-release.yaml index d6a8e2a..701a1f1 100644 --- a/.github/workflows/maven-release.yaml +++ b/.github/workflows/maven-release.yaml @@ -1,28 +1,14 @@ -name: Publish to release repo +name: "Publish to release repo" + on: release: types: [published] jobs: publish: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" steps: - - uses: actions/checkout@v3 - - name: Get Commit Hash - id: commit - uses: pr-mpt/actions-commit-hash@v2 - - name: Set up Java - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'adopt' - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 - - name: Publish package - uses: gradle/gradle-build-action@ced6859e9c4c384100f94984814deb1bd361f648 + - uses: "emortalmc/actions/java/publish-release@main" with: - arguments: publishMavenPublicationToReleaseRepository - env: - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_SECRET: ${{ secrets.MAVEN_SECRET }} - RELEASE_VERSION: ${{ github.ref_name }} + maven-username: "${{ secrets.MAVEN_USERNAME }}" + maven-password: "${{ secrets.MAVEN_SECRET }}" diff --git a/build.gradle.kts b/build.gradle.kts index 911a0f2..f017357 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,7 @@ dependencies { java { toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + languageVersion.set(JavaLanguageVersion.of(21)) } withSourcesJar() diff --git a/src/main/java/dev/emortal/api/modules/ModuleManager.java b/src/main/java/dev/emortal/api/modules/ModuleManager.java index df92487..d472b87 100644 --- a/src/main/java/dev/emortal/api/modules/ModuleManager.java +++ b/src/main/java/dev/emortal/api/modules/ModuleManager.java @@ -38,7 +38,7 @@ public final class ModuleManager implements ModuleProvider { private final Map, Module> modules = new ConcurrentHashMap<>(); - public ModuleManager(@NotNull ModuleCandidateResolver candidateResolver, @NotNull ModuleSorter sorter, + private ModuleManager(@NotNull ModuleCandidateResolver candidateResolver, @NotNull ModuleSorter sorter, @NotNull ModuleEnvironmentProvider environmentProvider) { this.candidateResolver = candidateResolver; this.sorter = sorter;