diff --git a/.github/workflows/release-lib.yml b/.github/workflows/release-lib.yml new file mode 100644 index 000000000..241262e2a --- /dev/null +++ b/.github/workflows/release-lib.yml @@ -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 }} + diff --git a/build.gradle.kts b/build.gradle.kts index fcad077ef..738cfb46c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,6 +24,63 @@ subprojects { group = "org.icpclive" version = rootProject.findProperty("build_version")!! + + plugins.withType { + afterEvaluate { + configure { + 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("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 { configure { toolchain { diff --git a/src/cds/core/build.gradle.kts b/src/cds/core/build.gradle.kts index b135e0edb..2174b9009 100644 --- a/src/cds/core/build.gradle.kts +++ b/src/cds/core/build.gradle.kts @@ -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) diff --git a/src/cds/plugins/build.gradle.kts b/src/cds/plugins/build.gradle.kts index df8877df6..2de4700c6 100644 --- a/src/cds/plugins/build.gradle.kts +++ b/src/cds/plugins/build.gradle.kts @@ -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) } @@ -11,11 +12,7 @@ apiValidation { } subprojects { - plugins.withType() { - kotlin { - explicitApi() - } - } + apply() } dependencies { diff --git a/src/clics-api/build.gradle.kts b/src/clics-api/build.gradle.kts index 66f391129..c4f2c494c 100644 --- a/src/clics-api/build.gradle.kts +++ b/src/clics-api/build.gradle.kts @@ -1,5 +1,6 @@ plugins { `java-library` + `maven-publish` alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.serialization) } diff --git a/src/common/build.gradle.kts b/src/common/build.gradle.kts index 9cc0b0ce5..372af1910 100644 --- a/src/common/build.gradle.kts +++ b/src/common/build.gradle.kts @@ -1,5 +1,6 @@ plugins { `java-library` + `maven-publish` alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.serialization) }