Skip to content

Commit

Permalink
Update CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Mar 7, 2024
1 parent 8c4132f commit 9e95ec9
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 52 deletions.
29 changes: 11 additions & 18 deletions .github/workflows/build-prs.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# File generated by the GradleUtils `setupGitHubActionsWorkflows` task, avoid modifying it directly
# The template can be found at https://github.com/neoforged/GradleUtils/blob/44d9e09cfa2c6032b84ac40495ea5ab7d64fe521/src/actionsTemplate/resources/.github/workflows/build-prs.yml

name: Build and test PRs

on:
Expand All @@ -7,24 +10,14 @@ on:
- opened
- ready_for_review
- reopened
push:
branches:
- 'feature/**'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1000
fetch-tags: true

- name: Setup JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'temurin'

- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build
uses: neoforged/actions/.github/workflows/build-prs.yml@main
with:
java: 8
gradle_tasks: test
29 changes: 29 additions & 0 deletions .github/workflows/publish-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# File generated by the GradleUtils `setupGitHubActionsWorkflows` task, avoid modifying it directly
# The template can be found at https://github.com/neoforged/GradleUtils/blob/44d9e09cfa2c6032b84ac40495ea5ab7d64fe521/src/actionsTemplate/resources/.github/workflows/publish-prs.yml

name: Publish PRs to GitHub Packages

on:
workflow_run:
workflows: [Build and test PRs]
types:
- completed
issue_comment:
types:
- edited
pull_request_target:
types:
- opened

permissions:
packages: write

jobs:
publish-prs:
if: true
uses: neoforged/actions/.github/workflows/publish-prs.yml@main
with:
artifact_base_path: net/neoforged/trainingwheels/
secrets:
PR_PUBLISHING_GH_APP_ID: ${{ secrets.PR_PUBLISHING_GH_APP_ID }}
PR_PUBLISHING_GH_APP_KEY: ${{ secrets.PR_PUBLISHING_GH_APP_KEY }}
18 changes: 9 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# File generated by the GradleUtils `setupGitHubActionsWorkflows` task, avoid modifying it directly
# The template can be found at https://github.com/neoforged/GradleUtils/blob/44d9e09cfa2c6032b84ac40495ea5ab7d64fe521/src/actionsTemplate/resources/.github/workflows/release.yml

name: Release

on:
Expand All @@ -9,19 +12,16 @@ permissions:
statuses: write

jobs:
build:
release:
uses: neoforged/actions/.github/workflows/gradle-publish.yml@main
with:
java: 8
gradle_tasks: 'publish closeAndReleaseSonatypeStagingRepository'
pre_gradle_tasks: test
gradle_tasks: publish closeAndReleaseSonatypeStagingRepository
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}

MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }}
GPG_SUBKEY: ${{ secrets.GPG_SUBKEY }}
GPG_SUBKEY_ID: ${{ secrets.GPG_SUBKEY_ID }}
GPG_SUBKEY_PASSWORD: ${{ secrets.GPG_SUBKEY_PASSWORD }}
34 changes: 11 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,19 @@ plugins {
}

group = 'net.neoforged.trainingwheels'
version = gradleutils.getTagOffsetVersion()
gradleutils {
version {
branches.suffixBranch()
}
setupCentralPublishing()
}
version = gradleutils.version

changelog {
fromTag '1.0'
from '1.0'
disableAutomaticPublicationRegistration()
}

nexusPublishing {
repositories {
sonatype {
username.set(System.getenv('SONATYPE_USER') ?: '')
password.set(System.getenv('SONATYPE_PASSWORD') ?: '')
nexusUrl.set(uri('https://s01.oss.sonatype.org/service/local/'))
}
}
}

subprojects { proj ->
apply plugin: 'java'
apply plugin: 'java-library'
Expand All @@ -32,7 +28,8 @@ subprojects { proj ->
apply plugin: 'maven-publish'

group = 'net.neoforged.trainingwheels'
version = rootProject.gradleutils.getTagOffsetVersion()
version = rootProject.version
gradleutils.setupSigning(signAllPublications: true)

java {
toolchain.languageVersion = JavaLanguageVersion.of(8)
Expand Down Expand Up @@ -91,16 +88,7 @@ subprojects { proj ->
}
}
repositories {
maven gradleutils.getPublishingForgeMaven()
}
}

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.mavenJava
maven gradleutils.publishingMaven
}
}
}
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
dependencyResolutionManagement {
versionCatalogs {
libs {
plugin('gradleutils', 'net.neoforged.gradleutils').version('2.+')
plugin('gradleutils', 'net.neoforged.gradleutils').version('3.0.0-alpha.10')
plugin('licenser', 'org.cadixdev.licenser').version('0.6.1')
plugin('nexus', 'io.github.gradle-nexus.publish-plugin').version('1.3.0')

Expand Down Expand Up @@ -44,4 +44,4 @@ rootProject.name = 'TrainingWheels'

project(':base').name = "TrainingWheels-Base"
project(':gradle-base').name = "TrainingWheels-Gradle-Base"
project(':gradle-functional').name = "TrainingWheels-Gradle-Functional"
project(':gradle-functional').name = "TrainingWheels-Gradle-Functional"

0 comments on commit 9e95ec9

Please sign in to comment.