Skip to content

Commit

Permalink
ci: set up publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
yusshu committed Aug 19, 2023
1 parent e263a10 commit 4c2234a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ jobs:
with:
java-version: 17
- name: 'build'
run: './gradlew build'
run: './gradlew build'
- name: 'publish'
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: './gradlew publish'
env:
ORG_GRADLE_PROJECT_unnamedRepositoryUsername: '${{ secrets.REPO_USER }}'
ORG_GRADLE_PROJECT_unnamedRepositoryPassword: '${{ secrets.REPO_PASSWORD }}'
32 changes: 29 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
plugins {
java
`maven-publish`
}

group = "team.unnamed"
version = "1.0.0"

repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
Expand All @@ -29,4 +27,32 @@ java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

val repositoryName: String by project
val snapshotRepository: String by project
val releaseRepository: String by project

publishing {
repositories {
maven {
val snapshot = project.version.toString().endsWith("-SNAPSHOT")
name = repositoryName
url = if (snapshot) { uri(snapshotRepository) } else { uri(releaseRepository) }
credentials(PasswordCredentials::class)
}
}
publications {
create<MavenPublication>("maven") {
from(getComponents().getByName("java"))
}
}
}

tasks {
processResources {
filesMatching("**.yml") {
expand("project" to project)
}
}
}
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
group=team.unnamed
version=2.0.0

repositoryName=unnamedRepository
snapshotRepository=https\://repo.unnamed.team/repository/unnamed-snapshots/
releaseRepository=https\://repo.unnamed.team/repository/unnamed-releases/
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: creative-faces
version: 1.0.0
version: ${project.version}
main: team.unnamed.creativefaces.FacesPlugin
api-version: 1.19
depend: [creative-central]
Expand Down

0 comments on commit 4c2234a

Please sign in to comment.