Skip to content

Commit

Permalink
Make publication
Browse files Browse the repository at this point in the history
  • Loading branch information
kunyavskiy committed Feb 24, 2024
1 parent a391b47 commit 01b834c
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 5 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/release-lib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish release of library

on:
workflow_dispatch:
inputs:
version:
description: Name of release
required: true
publish:
type: boolean
description: Would release be published
required: true
default: true
draft:
type: boolean
description: Publish draft first
required: true
default: true

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-instance

jobs:
build:
name: Create artifacts from master
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'src/frontend/package-lock.json'
- uses: actions/setup-java@master
with:
distribution: adopt
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Publish package
run: ./gradlew publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

57 changes: 57 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,63 @@ subprojects {
group = "org.icpclive"
version = rootProject.findProperty("build_version")!!


plugins.withType<MavenPublishPlugin> {
afterEvaluate {
configure<PublishingExtension> {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/icpc/live-v3")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
create<MavenPublication>("mavenJava${this@subprojects.name}") {
pom {
name = "ICPC live contest data system parser"
description = "Parser for a various programming competition contest systems"
url = "https://github.com/icpc/live-v3"
licenses {
license {
name = "The MIT License"
url = "http://opensource.org/licenses/MIT"
}
}
scm {
connection.set("scm:git:git://github.com/icpc/live-v3.git")
developerConnection.set("scm:git:ssh://github.com/icpc/live-v3.git")
url.set("https://github.com/icpc/live-v3")
}
}
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
from(components["java"])
groupId = "org.icpclive"
val projectPath = this@subprojects.path
artifactId = when {
projectPath.endsWith("plugins") -> {
"org.icpclive.cds.full"
}
else -> {
"org.icpclive.cds.${projectPath}"
}
}
}
}
}
}
}

plugins.withType<JavaPlugin> {
configure<JavaPluginExtension> {
toolchain {
Expand Down
1 change: 1 addition & 0 deletions src/cds/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import java.net.*

plugins {
`java-library`
`maven-publish`
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.dokka)
Expand Down
7 changes: 2 additions & 5 deletions src/cds/plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin

plugins {
`java-library`
`maven-publish`
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.bcv)
}
Expand All @@ -11,11 +12,7 @@ apiValidation {
}

subprojects {
plugins.withType<KotlinPlatformJvmPlugin>() {
kotlin {
explicitApi()
}
}
apply<MavenPublishPlugin>()
}

dependencies {
Expand Down
1 change: 1 addition & 0 deletions src/clics-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
`java-library`
`maven-publish`
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
}
Expand Down
1 change: 1 addition & 0 deletions src/common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
`java-library`
`maven-publish`
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
}
Expand Down

0 comments on commit 01b834c

Please sign in to comment.