Skip to content

Commit

Permalink
Initial attempt at CI publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Jan 20, 2024
1 parent 2746d5a commit c7bc5f8
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 6 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: 17
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: dev/su5ed/sinytra/adapter/adapter/
secrets:
PR_PUBLISHING_GH_APP_ID: ${{ secrets.PR_PUBLISHING_GH_APP_ID }}
PR_PUBLISHING_GH_APP_KEY: ${{ secrets.PR_PUBLISHING_GH_APP_KEY }}
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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: [ "master" ]

permissions:
contents: read
statuses: write

jobs:
release:
uses: neoforged/actions/.github/workflows/gradle-publish.yml@main
with:
java: 17
pre_gradle_tasks: test
gradle_tasks: publish
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
MAVEN_USER: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ base {
archivesName.set(project.name.lowercase())
}

println("Project version: $version")
println("Data version: $version")

java {
toolchain {
Expand Down Expand Up @@ -66,4 +66,4 @@ publishing {
}
}
}
}
}
14 changes: 11 additions & 3 deletions definition/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
plugins {
`java-library`
`maven-publish`
id("net.neoforged.gradleutils").version("3.0.0-alpha.10")
}

group = "dev.su5ed.sinytra.adapter"
version = "1.10.5"
gradleutils.version {
branches {
suffixBranch()
}
}

version = gradleutils.version
println("Definition version: $version")

java {
toolchain {
Expand Down Expand Up @@ -69,9 +77,9 @@ publishing {
name = "Su5eD"
url = uri("https://maven.su5ed.dev/releases")
credentials {
username = System.getenv("MAVEN_USERNAME") ?: "not"
username = System.getenv("MAVEN_USER") ?: "not"
password = System.getenv("MAVEN_PASSWORD") ?: "set"
}
}
}
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down

0 comments on commit c7bc5f8

Please sign in to comment.