diff --git a/.github/.kodiak.toml b/.github/.kodiak.toml new file mode 100644 index 0000000..a963117 --- /dev/null +++ b/.github/.kodiak.toml @@ -0,0 +1,15 @@ +version = 1 + +[approve] +auto_approve_usernames = ["cq-bot"] + +[merge.message] +body = "pull_request_body" +cut_body_after = "Use the following steps to ensure your PR is ready to be reviewed" +cut_body_and_text = true +cut_body_before = "" +title = "pull_request_title" + +[merge] +blocking_labels = ["wip", "no automerge"] +notify_on_conflict = false diff --git a/.github/renovate.json5 b/.github/renovate.json5 new file mode 100644 index 0000000..df06f33 --- /dev/null +++ b/.github/renovate.json5 @@ -0,0 +1,3 @@ +{ + extends: ["github>cloudquery/.github//.github/renovate-java-default.json5"], +} diff --git a/.github/workflows/pr_title.yml b/.github/workflows/pr_title.yml new file mode 100644 index 0000000..c7c8e47 --- /dev/null +++ b/.github/workflows/pr_title.yml @@ -0,0 +1,49 @@ +name: "Validate PR title" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + # Please look up the latest version from + # https://github.com/amannn/action-semantic-pull-request/releases + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # Configure which types are allowed. + # Default: https://github.com/commitizen/conventional-commit-types + types: | + fix + feat + chore + refactor + test + # Configure that a scope must always be provided. + requireScope: false + # If `subjectPattern` is configured, you can use this property to override + # the default error message that is shown when the pattern doesn't match. + # The variables `subject` and `title` can be used within the message. + subjectPatternError: | + The subject "{subject}" found in the pull request title "{title}" + didn't match the configured pattern. Please ensure that the subject + starts with an uppercase character. + # For work-in-progress PRs you can typically use draft pull requests + # from Github. However, private repositories on the free plan don't have + # this option and therefore this action allows you to opt-in to using the + # special "[WIP]" prefix to indicate this state. This will avoid the + # validation of the PR title and the pull request checks remain pending. + # Note that a second check will be reported if this is enabled. + wip: true + # When using "Squash and merge" on a PR with only one commit, GitHub + # will suggest using that commit message instead of the PR title for the + # merge commit, and it's easy to commit this by mistake. Enable this option + # to also validate the commit message for one commit PRs. + validateSingleCommit: false diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..27671c9 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,25 @@ +name: publish +on: + push: + tags: + - 'v*.*.*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '18' + cache: 'gradle' + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 + - name: Publish package + uses: gradle/gradle-build-action@a4cf152f482c7ca97ef56ead29bf08bcd953284c + with: + arguments: publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release_pr.yml b/.github/workflows/release_pr.yml new file mode 100644 index 0000000..b4f779d --- /dev/null +++ b/.github/workflows/release_pr.yml @@ -0,0 +1,23 @@ +name: release-please +on: + push: + branches: + - main + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v3 + id: release + with: + release-type: simple + package-name: plugin-sdk-java + token: ${{ secrets.GH_CQ_BOT }} + pull-request-title-pattern: "chore${scope}: Release${component} v${version}" + # Should breaking changes before 1.0.0 produce minor bumps? + bump-minor-pre-major: true + # Should feat changes before 1.0.0 produce patch bumps instead of minor bumps? + bump-patch-for-minor-pre-major: true + extra-files: | + lib/build.gradle diff --git a/lib/build.gradle b/lib/build.gradle index 73d5ad6..bdc7821 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -1,8 +1,14 @@ plugins { id 'java-library' id "io.freefair.lombok" version "8.1.0" + id "maven-publish" } +group 'io.cloudquery' +// x-release-please-start-version +version = '0.0.1' +// x-release-please-end + repositories { maven { url = uri("https://maven.pkg.github.com/cloudquery/plugin-pb-java") @@ -26,7 +32,7 @@ dependencies { implementation "io.grpc:grpc-stub:1.57.0" implementation "io.grpc:grpc-services:1.57.0" implementation "io.grpc:grpc-testing:1.15.1" - implementation 'com.cloudquery:plugin-pb-java:0.0.2' + implementation "io.cloudquery:plugin-pb-java:0.0.5" } testing { @@ -45,3 +51,21 @@ java { languageVersion = JavaLanguageVersion.of(20) } } + +publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/cloudquery/plugin-sdk-java") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } + publications { + gpr(MavenPublication) { + from(components.java) + } + } +} diff --git a/lib/src/main/java/io/cloudquery/internal/servers/discovery/v1/DiscoverServer.java b/lib/src/main/java/io/cloudquery/internal/servers/discovery/v1/DiscoverServer.java index 447639f..676ed44 100644 --- a/lib/src/main/java/io/cloudquery/internal/servers/discovery/v1/DiscoverServer.java +++ b/lib/src/main/java/io/cloudquery/internal/servers/discovery/v1/DiscoverServer.java @@ -1,8 +1,8 @@ package io.cloudquery.internal.servers.discovery.v1; -import cloudquery.discovery.v1.DiscoveryGrpc.DiscoveryImplBase; -import cloudquery.discovery.v1.DiscoveryOuterClass.GetVersions.Request; -import cloudquery.discovery.v1.DiscoveryOuterClass.GetVersions.Response; +import io.cloudquery.discovery.v1.DiscoveryGrpc.DiscoveryImplBase; +import io.cloudquery.discovery.v1.GetVersions.Request; +import io.cloudquery.discovery.v1.GetVersions.Response; import io.grpc.stub.StreamObserver; import java.util.List; diff --git a/lib/src/main/java/io/cloudquery/internal/servers/plugin/v3/PluginServer.java b/lib/src/main/java/io/cloudquery/internal/servers/plugin/v3/PluginServer.java index e700f65..78faa56 100644 --- a/lib/src/main/java/io/cloudquery/internal/servers/plugin/v3/PluginServer.java +++ b/lib/src/main/java/io/cloudquery/internal/servers/plugin/v3/PluginServer.java @@ -1,6 +1,6 @@ package io.cloudquery.internal.servers.plugin.v3; -import cloudquery.plugin.v3.PluginGrpc.PluginImplBase; +import io.cloudquery.plugin.v3.PluginGrpc.PluginImplBase; import io.cloudquery.plugin.Plugin; public class PluginServer extends PluginImplBase {