diff --git a/.github/workflows/build-prs.yml b/.github/workflows/build-prs.yml new file mode 100644 index 000000000..9ed78be2e --- /dev/null +++ b/.github/workflows/build-prs.yml @@ -0,0 +1,30 @@ +name: Build and test PRs + +on: + pull_request: + types: + - synchronize + - opened + - ready_for_review + - reopened + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1000 + fetch-tags: true + + - name: Setup JDK 17 + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'temurin' + + - name: Build with Gradle + uses: gradle/gradle-build-action@v2 + with: + arguments: build \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..44e281903 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: Release + +on: + push: + branches: [ "main" ] + +permissions: + contents: read + statuses: write + +jobs: + build: + uses: neoforged/actions/.github/workflows/gradle-publish.yml@main + with: + java: 17 + gradle_tasks: 'publish' + secrets: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + + MAVEN_USER: ${{ secrets.MAVEN_USER }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }} \ No newline at end of file diff --git a/.teamcity/pom.xml b/.teamcity/pom.xml deleted file mode 100644 index cda9e71b7..000000000 --- a/.teamcity/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - 4.0.0 - neoforged_neoforged_FancyModLoader Config DSL Script - MinecraftForge_neoforged_FancyModLoader - MinecraftForge_neoforged_FancyModLoader_dsl - 1.0-SNAPSHOT - - - org.jetbrains.teamcity - configs-dsl-kotlin-parent - 1.0-SNAPSHOT - - - - - jetbrains-all - https://download.jetbrains.com/teamcity-repository - - true - - - - teamcity-server - https://teamcity.neoforged.net/app/dsl-plugins-repository - - true - - - - - - - JetBrains - https://download.jetbrains.com/teamcity-repository - - - - - ${basedir} - - - kotlin-maven-plugin - org.jetbrains.kotlin - ${kotlin.version} - - - - - compile - process-sources - - compile - - - - test-compile - process-test-sources - - test-compile - - - - - - org.jetbrains.teamcity - teamcity-configs-maven-plugin - ${teamcity.dsl.version} - - kotlin - target/generated-configs - - - - - - - - org.jetbrains.teamcity - configs-dsl-kotlin - ${teamcity.dsl.version} - compile - - - org.jetbrains.teamcity - configs-dsl-kotlin-plugins - 1.0-SNAPSHOT - pom - compile - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - ${kotlin.version} - compile - - - org.jetbrains.kotlin - kotlin-script-runtime - ${kotlin.version} - compile - - - \ No newline at end of file diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts deleted file mode 100644 index 21d8e046a..000000000 --- a/.teamcity/settings.kts +++ /dev/null @@ -1,71 +0,0 @@ -import jetbrains.buildServer.configs.kotlin.v2019_2.* -import jetbrains.buildServer.configs.kotlin.v2019_2.projectFeatures.githubIssues - -/* -The settings script is an entry point for defining a TeamCity -project hierarchy. The script should contain a single call to the -project() function with a Project instance or an init function as -an argument. - -VcsRoots, BuildTypes, Templates, and subprojects can be -registered inside the project using the vcsRoot(), buildType(), -template(), and subProject() methods respectively. - -To debug settings scripts in command-line, run the - - mvnDebug org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate - -command and attach your debugger to the port 8000. - -To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View --> Tool Windows -> Maven Projects), find the generate task node -(Plugins -> teamcity-configs -> teamcity-configs:generate), the -'Debug' option is available in the context menu for the task. -*/ - -version = "2021.2" - -project { - - buildType(Build) - buildType(BuildSecondaryBranches) - buildType(PullRequests) - - params { - text("git_main_branch", "main", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false) - text("github_repository_name", "FancyModLoader", label = "The github repository name. Used to connect to it in VCS Roots.", description = "This is the repository slug on github. So for example `FancyModLoader` or `MinecraftForge`. It is interpolated into the global VCS Roots.", display = ParameterDisplay.HIDDEN, allowEmpty = false) - text("env.PUBLISHED_JAVA_ARTIFACT_ID", "fancymodloader", label = "Published artifact id", description = "The maven coordinate artifact id that has been published by this build. Can not be empty.", allowEmpty = false) - text("env.PUBLISHED_JAVA_GROUP", "net.neoforged.fancymodloader", label = "Published group", description = "The maven coordinate group that has been published by this build. Can not be empty.", allowEmpty = false) - text("docker_jdk_version", "8", label = "JDK version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false) - text("docker_gradle_version", "8.1.1", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false) - } - - features { - githubIssues { - id = "FancyModLoader__IssueTracker" - displayName = "neoforged/FancyModLoader" - repositoryURL = "https://github.com/neoforged/FancyModLoader" - } - } -} - -object Build : BuildType({ - templates(AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_BuildMainBranches"), AbsoluteId("MinecraftForge_BuildUsingGradle"), AbsoluteId("MinecraftForge_PublishProjectUsingGradle"), AbsoluteId("MinecraftForge_TriggersStaticFilesWebpageGenerator")) - id("FancyModLoader__Build") - name = "Build" - description = "Builds and Publishes the main branches of the project." -}) - -object BuildSecondaryBranches : BuildType({ - templates(AbsoluteId("MinecraftForge_ExcludesBuildingDefaultBranch"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_BuildMainBranches"), AbsoluteId("MinecraftForge_BuildUsingGradle")) - id("FancyModLoader__BuildSecondaryBranches") - name = "Build - Secondary Branches" - description = "Builds and Publishes the secondary branches of the project." -}) - -object PullRequests : BuildType({ - templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_BuildUsingGradle")) - id("FancyModLoader__PullRequests") - name = "Pull Requests" - description = "Builds pull requests for the project" -}) diff --git a/build.gradle b/build.gradle index 4be9bf01e..7cb490cf4 100644 --- a/build.gradle +++ b/build.gradle @@ -5,10 +5,15 @@ plugins { id 'net.neoforged.gradleutils' version '[2.0.18,3)' } +changelog { + disableAutomaticPublicationRegistration() +} + allprojects { apply plugin: 'java-library' apply plugin: 'jacoco' apply plugin: 'maven-publish' + apply plugin: 'signing' apply plugin: 'com.github.ben-manes.versions' apply plugin: 'org.javamodularity.moduleplugin' @@ -55,9 +60,7 @@ subprojects { subProject -> jar.doFirst { manifest.attributes( - 'Timestamp' : new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), 'Git-Commit' : gradleutils.gitInfo.abbreviatedId, - 'Git-Branch' : gradleutils.gitInfo.branch, 'Build-Number': "${subProject.version}", 'Automatic-Module-Name' : "fml_${subProject.name.replace("-", "_")}", 'FMLModType' : subProject.name.startsWith("language") ? 'LANGPROVIDER' : subProject.name == "events" ? 'GAMELIBRARY' : 'LIBRARY', @@ -97,6 +100,15 @@ subprojects { subProject -> } } + if (System.getenv('GPG_PRIVATE_KEY')) { + signing { + final signingKey = System.getenv('GPG_PRIVATE_KEY') ?: '' + final signingPassword = System.getenv('GPG_KEY_PASSWORD') ?: '' + useInMemoryPgpKeys(signingKey, signingPassword) + sign publishing.publications.maven + } + } + changelog { fromTag "1.0" }