Skip to content

Commit

Permalink
Setup publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Mar 19, 2024
1 parent 8f5c9fc commit 7f9236b
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 5 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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:
pull_request:
types:
- synchronize
- opened
- ready_for_review
- reopened
push:
branches:
- 'feature/**'
workflow_dispatch:

jobs:
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: false # Option not enabled when the workflows were generated
uses: neoforged/actions/.github/workflows/publish-prs.yml@main
with:
artifact_base_path: net/neoforged/jarcompatibilitychecker/
secrets:
PR_PUBLISHING_GH_APP_ID: ${{ secrets.PR_PUBLISHING_GH_APP_ID }}
PR_PUBLISHING_GH_APP_KEY: ${{ secrets.PR_PUBLISHING_GH_APP_KEY }}
29 changes: 29 additions & 0 deletions .github/workflows/release.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/release.yml

name: Release

on:
push:
branches: [ "main" ]

permissions:
contents: read
statuses: write

jobs:
release:
uses: neoforged/actions/.github/workflows/gradle-publish.yml@main
with:
java: 8
pre_gradle_tasks: test
gradle_tasks: publish # TODO - publish to central (closeAndReleaseSonatypeStagingRepository) and GPP
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GPG_SUBKEY: ${{ secrets.GPG_SUBKEY }}
GPG_SUBKEY_ID: ${{ secrets.GPG_SUBKEY_ID }}
GPG_SUBKEY_PASSWORD: ${{ secrets.GPG_SUBKEY_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import net.neoforged.gradleutils.PomUtilsExtension.License

plugins {
id 'java-library'
id 'signing'
id 'java-library'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'net.neoforged.gradleutils' version '3.0.0-alpha.10'
Expand All @@ -18,7 +18,6 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(8)

gradleutils {
setupSigning()
setupCentralPublishing()
}

ext {
Expand Down
8 changes: 7 additions & 1 deletion plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
id 'com.gradle.plugin-publish' version '1.1.0'
}

version '1.0.0'
version rootProject.version
group 'net.neoforged.jarcompatibilitychecker'

java {
Expand Down Expand Up @@ -38,3 +38,9 @@ gradlePlugin {
}
}
}

publishing {
repositories {
maven gradleutils.publishingMaven
}
}
4 changes: 3 additions & 1 deletion tests/base/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
plugins {
id 'java'
id 'java-library'
}

group rootProject.group

repositories {
mavenCentral()
}
Expand Down
4 changes: 3 additions & 1 deletion tests/top/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
plugins {
id 'java'
id 'java-library'
}

group rootProject.group

0 comments on commit 7f9236b

Please sign in to comment.