diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index b7f0dec..6d02f42 100755 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -4,31 +4,15 @@ on: [push, pull_request, workflow_dispatch] jobs: Build: - runs-on: [self-hosted, docker] + runs-on: ubuntu-latest permissions: checks: write timeout-minutes: 30 - container: - image: ghcr.io/project-tsurugi/oltp-sandbox:ubuntu-22.04 - credentials: - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_PAT }} - volumes: - - ${{ vars.gradle_cache_dir }}:/root/.gradle defaults: run: shell: bash env: JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 - GPR_USER: ${{ github.repository_owner }} - GPR_KEY: ${{ secrets.GHCR_PAT }} - - services: - tsurugi: - image: ghcr.io/project-tsurugi/tsurugi:latest - credentials: - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_PAT }} steps: - name: Setup_Java @@ -60,9 +44,8 @@ jobs: Publish: uses: ./.github/workflows/ci-publish.yml - if: (contains(github.ref, '/tags/') || contains(github.ref, '/heads/master')) + if: github.repository_owner == 'project-tsurugi' && (contains(github.ref, '/tags/') || contains(github.ref, '/heads/master')) needs: Build secrets: inherit permissions: contents: write - packages: write diff --git a/.github/workflows/ci-publish.yml b/.github/workflows/ci-publish.yml index 4a05f67..cccd784 100755 --- a/.github/workflows/ci-publish.yml +++ b/.github/workflows/ci-publish.yml @@ -1,28 +1,19 @@ name: Tanzawa-CI-Publish on: [workflow_dispatch, workflow_call] +concurrency: ${{ github.workflow }} jobs: Publish: - runs-on: [self-hosted, docker] + runs-on: ubuntu-latest permissions: contents: write - packages: write timeout-minutes: 30 - container: - image: ghcr.io/project-tsurugi/oltp-sandbox:ubuntu-22.04 - credentials: - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_PAT }} - volumes: - - ${{ vars.gradle_cache_dir }}:/root/.gradle defaults: run: shell: bash env: JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 - GPR_USER: ${{ github.repository_owner }} - GPR_KEY: ${{ secrets.GHCR_PAT }} steps: - name: Setup_Java @@ -39,6 +30,12 @@ jobs: - name: Publish run: | ./gradlew -i tanzawa-core:showTsubakuroManifest clean publish + env: + ST_OSSRH_USER: ${{ secrets.ST_OSSRH_USER }} + ST_OSSRH_PASSWORD: ${{ secrets.ST_OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} - id: Create_Release name: Create_Release diff --git a/buildSrc/src/main/groovy/tanzawa.java-conventions.gradle b/buildSrc/src/main/groovy/tanzawa.java-conventions.gradle index 3e9316a..05d4e0f 100644 --- a/buildSrc/src/main/groovy/tanzawa.java-conventions.gradle +++ b/buildSrc/src/main/groovy/tanzawa.java-conventions.gradle @@ -12,24 +12,16 @@ if (hasProperty('mavenLocal')) { } else { repositories { maven { - url 'https://maven.pkg.github.com/project-tsurugi/*' + url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' content { includeGroupByRegex 'com\\.tsurugidb.*' } - credentials { - username findProperty('gpr.user') ?: System.getenv('GPR_USER') - password findProperty('gpr.key') ?: System.getenv('GPR_KEY') - } } } } repositories { - mavenCentral { - content { - excludeGroupByRegex 'com\\.tsurugidb.*' - } - } + mavenCentral() } configurations.all { @@ -38,6 +30,7 @@ configurations.all { java { withSourcesJar() + withJavadocJar() } dependencies { @@ -66,6 +59,8 @@ spotbugsMain { spotbugsTest.enabled = false checkstyleTest.enabled = false +javadoc.failOnError = false + jar { manifest.attributes ( 'Build-Timestamp': buildTimestamp, diff --git a/buildSrc/src/main/groovy/tanzawa.libs-conventions.gradle b/buildSrc/src/main/groovy/tanzawa.libs-conventions.gradle index 66fdf0c..88afc20 100644 --- a/buildSrc/src/main/groovy/tanzawa.libs-conventions.gradle +++ b/buildSrc/src/main/groovy/tanzawa.libs-conventions.gradle @@ -1,6 +1,7 @@ plugins { id 'java-library' id 'java-test-fixtures' + id 'signing' id 'maven-publish' id 'tanzawa.java-conventions' @@ -9,17 +10,48 @@ plugins { publishing { repositories { maven { - name 'GitHubPackages' - url 'https://maven.pkg.github.com/project-tsurugi/tanzawa' + name 'OSSRH' + def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" + def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" + url version.endsWith('-SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl credentials { - username findProperty('gpr.user') ?: System.getenv('GPR_USER') - password findProperty('gpr.key') ?: System.getenv('GPR_KEY') + username findProperty('st.ossrh.user') ?: System.getenv('ST_OSSRH_USER') + password findProperty('st.ossrh.password') ?: System.getenv('ST_OSSRH_PASSWORD') } } } publications { mavenJava(MavenPublication) { from components.java + pom { + name = 'Tanzawa' + description = 'Tsurugi SQL console engine is a core library of Tsurugi SQL console.' + url = 'https://github.com/project-tsurugi/tanzawa' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id = 'project-tsurugi' + } + } + scm { + connection = 'scm:git:https://github.com/project-tsurugi/tanzawa.git' + developerConnection = 'scm:git:https://github.com/project-tsurugi/tanzawa.git' + url = 'https://github.com/project-tsurugi/tanzawa' + } + } } } } + +signing { + def signingKeyId = findProperty("signingKeyId") + def signingKey = findProperty("signingKey") + def signingPassword = findProperty("signingPassword") + useInMemoryPgpKeys(signingKey, signingPassword) + sign publishing.publications.mavenJava +}