diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 53b6f3f797a82fce8334d31a58195b7ce405d836..31c9685baa1b77d0a386678df2b4c21eb38dac39 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,7 @@ --- name: Bug Report about: Create a report to help us improve graphql-java-codegen -title: "[Short Description] (Version: [graphql-java-codegen version])" +title: "[Short Description]" labels: bug assignees: '' @@ -22,9 +22,8 @@ assignees: '' ## Your Environment and Setup -* **graphql-java-codegen**: *E.g.: 4.1.3* -* **Build tool**: *E.g.: Maven* -* **Java tool**: *E.g.: Oracle 8u241* +* **graphql-java-codegen version**: *X.X.X* +* **Build tool**: *E.g.: Maven/Gradle/SBT* * **Mapping Config**: *E.g.:* ```xml @@ -33,6 +32,3 @@ assignees: '' io.github.kobylynskyi.graphql.model ``` - -## Additional context -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7d61558adde3cbfd0c7a63a67c27ed6d30..18d53ad67e056b8d5d023388a405dfd95cbd26e3 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -15,6 +15,3 @@ A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000000000000000000000000000000000..9a89bb0a13c5fde56509be40a011e06bdecee84a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,193 @@ +name: Build + +on: + workflow_dispatch: + inputs: + release_version: + description: 'Release version' + default: 'X.X.X' + required: true + release_branch: + description: 'Release branch' + default: 'master' + required: true + publish_library: + description: 'Publish library' + default: 'true' + required: true + publish_gradle_plugin: + description: 'Publish Gradle Plugin' + default: 'true' + required: true + publish_maven_plugin: + description: 'Publish Maven Plugin' + default: 'true' + required: true + publish_sbt_plugin: + description: 'Publish SBT Plugin' + default: 'true' + required: true + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.inputs.release_branch }} + + - name: Setup Java + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Gradle cache + uses: actions/cache@v1 + with: + path: ~/.gradle + key: gradle + + - name: Maven cache + uses: actions/cache@v1 + with: + path: ~/.m2 + key: m2 + + - name: Loading ivy cache + uses: actions/cache@v1 + with: + path: ~/.ivy2/cache + key: ${{ runner.os }}-ivy-${{ hashFiles('**/*.sbt') }} + restore-keys: | + ${{ runner.os }}-ivy- + + - name: Update version of Maven plugin sub-project + working-directory: plugins/maven/graphql-java-codegen-maven-plugin + run: mvn versions:set -DnewVersion="${{ github.event.inputs.release_version }}" -DgenerateBackupPoms=false + + - name: Update version of Maven example client sub-project + working-directory: plugins/maven/example-client + run: mvn versions:set -DnewVersion="${{ github.event.inputs.release_version }}" -DgenerateBackupPoms=false + + - name: Update version of Maven example server sub-project + working-directory: plugins/maven/example-server + run: mvn versions:set -DnewVersion="${{ github.event.inputs.release_version }}" -DgenerateBackupPoms=false + + - name: Update versions of all Gradle/SBT sub-projects + run: scripts/update-release-version-in-build-files.sh ${{ github.event.inputs.release_version }} + + - name: Update versions in all README files + run: scripts/update-release-version-in-readme.sh ${{ github.event.inputs.release_version }} + + # + # VERSIONS ARE IN THE RELEASE STATE, SO WE CAN COMMIT THEM + # + + - name: Commit release version so that iw will be pus + run: | + git config --global user.name 'Bogdan Kobylynskyi' + git config --global user.email 'kobylynskyi@users.noreply.github.com' + git commit -am "Bump version to ${{ github.event.inputs.release_version }}" + + # + # VERSIONS UPDATED + # NOW WE ARE READY FOR THE FINAL BUILD + # + + - name: Build library + run: ./gradlew build publishToMavenLocal publishAllPublicationsToIvyRepository --warning-mode all + + - name: Build gradle plugin + run: ./gradlew -p plugins/gradle/graphql-java-codegen-gradle-plugin build publishToMavenLocal --warning-mode all + + - name: Update version of Maven plugin to SNAPSHOT (required by publish-plugin) + working-directory: plugins/maven/graphql-java-codegen-maven-plugin + run: mvn versions:set -DnewVersion="${{ github.event.inputs.release_version }}-SNAPSHOT" -DgenerateBackupPoms=false + + - name: Build maven plugin + working-directory: plugins/maven/graphql-java-codegen-maven-plugin + run: mvn install + + - name: Build sbt plugin + working-directory: plugins/sbt/graphql-java-codegen-sbt-plugin + run: sbt compile publishLocal --debug + + - name: Build sbt test + working-directory: plugins/sbt/graphql-java-codegen-sbt-plugin + run: sbt scripted + + - name: Build gradle example-server --warning-mode all + run: ./gradlew -p plugins/gradle/example-server test --warning-mode all + + - name: Build gradle example-client + run: ./gradlew -p plugins/gradle/example-client test --warning-mode all + + - name: Build gradle example-client-kotlin + run: ./gradlew -p plugins/gradle/example-client-kotlin build --warning-mode all + + - name: Build maven example-server + working-directory: plugins/maven/example-server + run: mvn package + + - name: Build maven example-client + working-directory: plugins/maven/example-client + run: mvn package + + - name: Install gpg secret key + run: cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import + + # + # BUILD OF RELEASE VERSION COMPLETED + # NOW PERFORMING THE PUBLISH + # + + - name: Release library + if: ${{ github.event.inputs.publish_library }} == "true" + run: | + ./gradlew publish \ + -Dorg.gradle.internal.publish.checksums.insecure=true \ + -Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY}} \ + -Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }} + env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + SIGNING_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }} + SIGNING_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} + RELEASE_VERSION: ${{ github.event.inputs.release_version }} + + - name: Release Gradle plugin + if: ${{ github.event.inputs.publish_gradle_plugin }} == "true" + run: | + ./gradlew \ + -p plugins/gradle/graphql-java-codegen-gradle-plugin \ + publishPlugins \ + -Dorg.gradle.internal.publish.checksums.insecure=true \ + -Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY}} \ + -Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }} + env: + SIGNING_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }} + SIGNING_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} + RELEASE_VERSION: ${{ github.event.inputs.release_version }} + + - name: Release Maven plugin + if: ${{ github.event.inputs.publish_maven_plugin }} == "true" + working-directory: plugins/maven/graphql-java-codegen-maven-plugin + run: | + mvn \ + --no-transfer-progress \ + --batch-mode \ + -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \ + release:clean release:prepare release:perform + + - name: Release SBT plugin + if: ${{ github.event.inputs.publish_sbt_plugin }} == "true" + working-directory: plugins/sbt/graphql-java-codegen-sbt-plugin + run: sbt release with-defaults default-tag-exists-answer k + + # + # PUBLISH OF RELEASE VERSION COMPLETED + # NOW PUSHING THE RELEASE VERSION BACK TO THE REPOSITORY + # + + - name: Push release version + run: git push --tags \ No newline at end of file diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml new file mode 100644 index 0000000000000000000000000000000000000000..2d666aa3f2e9ec2e5e27d53b678417cee4ac3759 --- /dev/null +++ b/.github/workflows/update-version.yml @@ -0,0 +1,36 @@ +name: Build + +on: + workflow_dispatch: + inputs: + new_version: + description: 'New version' + required: true + +jobs: + update-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Update version of Maven plugin sub-project + working-directory: plugins/maven/graphql-java-codegen-maven-plugin + run: mvn versions:set -DnewVersion="${{ github.event.inputs.new_version }}" -DgenerateBackupPoms=false + + - name: Update version of Maven example client sub-project + working-directory: plugins/maven/example-client + run: mvn versions:set -DnewVersion="${{ github.event.inputs.new_version }}" -DgenerateBackupPoms=false + + - name: Update version of Maven example server sub-project + working-directory: plugins/maven/example-server + run: mvn versions:set -DnewVersion="${{ github.event.inputs.new_version }}" -DgenerateBackupPoms=false + + - name: Update versions of all Gradle/SBT sub-projects + run: scripts/update-release-version-in-build-files.sh ${{ github.event.inputs.new_version }} + + - name: Commit and push a new version + run: | + git config --global user.name 'Bogdan Kobylynskyi' + git config --global user.email 'kobylynskyi@users.noreply.github.com' + git commit -am "Bump version to ${{ github.event.inputs.new_version }}" + git push --tags diff --git a/build.gradle b/build.gradle index baf7d4d6a851a2a244fe8a40d149c4585d5695a9..39588ac2645afa310bee26622692fbf78d3d22e4 100644 --- a/build.gradle +++ b/build.gradle @@ -9,8 +9,10 @@ plugins { id "org.sonarqube" version "3.1.1" } -version = "4.1.4-SNAPSHOT" +def graphqlCodegenVersion = '4.1.4-SNAPSHOT' // This variable used in the automatic release process + group = "io.github.kobylynskyi" +version = graphqlCodegenVersion repositories { mavenCentral() diff --git a/plugins/gradle/example-client-kotlin/build.gradle b/plugins/gradle/example-client-kotlin/build.gradle index 09158246a42e9ad57fa489b8b65172082675a3b6..cbe787f787e53b6e4c6a966f3b9c24422cf33afb 100644 --- a/plugins/gradle/example-client-kotlin/build.gradle +++ b/plugins/gradle/example-client-kotlin/build.gradle @@ -7,8 +7,10 @@ plugins { id "io.github.kobylynskyi.graphql.codegen" version "4.1.4-SNAPSHOT" } -group 'io.github.dreamylost' -version '4.1.4-SNAPSHOT' +def graphqlCodegenClientKotlinVersion = '4.1.4-SNAPSHOT' // Variable used in the automatic release process + +group = 'io.github.dreamylost' +version = graphqlCodegenClientKotlinVersion sourceCompatibility = 1.8 diff --git a/plugins/gradle/graphql-java-codegen-gradle-plugin/build.gradle b/plugins/gradle/graphql-java-codegen-gradle-plugin/build.gradle index b2bdac1f3284240e22d88bf64d0b949d1f51e38e..d6743f018d68534aa2be0b2322dba4e6bc04b6b6 100644 --- a/plugins/gradle/graphql-java-codegen-gradle-plugin/build.gradle +++ b/plugins/gradle/graphql-java-codegen-gradle-plugin/build.gradle @@ -16,8 +16,10 @@ apply plugin: "java" apply plugin: "idea" apply plugin: "maven-publish" +def graphqlCodegenGradlePluginVersion = '4.1.4-SNAPSHOT' // This variable used in the automatic release process + group = "io.github.kobylynskyi" -version = "4.1.4-SNAPSHOT" +version = graphqlCodegenGradlePluginVersion description = "Provides a task for generating Java code based on GraphQL schema" dependencies { diff --git a/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml b/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml index 012c1588b3208f993643e23ceccedd23fb3c3c41..5e62cea36c142ba1b69cfd4ad1ce279728880e72 100644 --- a/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml +++ b/plugins/maven/graphql-java-codegen-maven-plugin/pom.xml @@ -3,8 +3,8 @@ io.github.kobylynskyi graphql-codegen-maven-plugin - maven-plugin 4.1.4-SNAPSHOT + maven-plugin graphql-codegen-maven-plugin Provides a goal for generating Java code based on GraphQL schema @@ -36,7 +36,6 @@ scm:git:git@github.com:kobylynskyi/graphql-java-codegen.git https://github.com/kobylynskyi/graphql-java-codegen/tree/master/plugins/maven - v4.1.3 @@ -67,10 +66,9 @@ 3.0.0-M1 1.6.8 2.5.3 + 3.2.0 1.11.2 1.6 - - 4.1.4-SNAPSHOT @@ -105,7 +103,7 @@ io.github.kobylynskyi graphql-java-codegen - ${version.graphql-java-codegen} + ${project.version} @@ -220,6 +218,34 @@ true + + org.codehaus.mojo + build-helper-maven-plugin + ${version.maven-build-helper-plugin} + + + parse-versions-for-release + initialize + + parse-version + + + parsedVersion + + + + + + org.apache.maven.plugins + maven-release-plugin + ${version.maven-release-plugin} + + v@{project.version} + + ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.patchVersion} + true + + @@ -247,6 +273,12 @@ sign + + + --pinentry-mode + loopback + + diff --git a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/build.sbt b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/build.sbt index 9cbd32bd49c4ef2b77aa059f8d902f2b1c8944f5..9ed24da68cc0a7df26f8c73ef603a92085958a0c 100644 --- a/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/build.sbt +++ b/plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/build.sbt @@ -21,8 +21,6 @@ graphqlJavaCodegenVersion := Some((version in Scope.ThisScope).value) GraphQLCodegenPluginDependencies -//default graphqlJavaCodegen is release -//graphqlJavaCodegenVersion := Some("4.1.4-SNAPSHOT") graphqlSchemaPaths := List("src/main/resources/schema.graphqls") modelPackageName := Some("io.github.dreamylost.model") apiPackageName := Some("io.github.dreamylost.api") diff --git a/scripts/update-release-version-in-build-files.sh b/scripts/update-release-version-in-build-files.sh new file mode 100755 index 0000000000000000000000000000000000000000..09cea7003344042746b79f964ecddcf1a0e22050 --- /dev/null +++ b/scripts/update-release-version-in-build-files.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +RELEASE_VERSION=$1 +RELEASE_VERSION_ESCAPED=${RELEASE_VERSION//./\\.} + +set_version_in_file() { + sed -i '' "s/$2[A-Z0-9.\-]*/$2$RELEASE_VERSION_ESCAPED/" "$1" + echo "Updated version in $1" +} + +set_version_in_file "build.gradle" "var graphqlCodegenVersion = '" + +set_version_in_file "plugins/gradle/graphql-java-codegen-gradle-plugin/build.gradle" "var graphqlCodegenGradlePluginVersion = '" + +set_version_in_file "plugins/gradle/example-server/build.gradle" "io.github.kobylynskyi.graphql.codegen\" version \"" + +set_version_in_file "plugins/gradle/example-client/build.gradle" "implementation \"io.github.kobylynskyi:graphql-java-codegen:" +set_version_in_file "plugins/gradle/example-client/build.gradle" "io.github.kobylynskyi.graphql.codegen\" version \"" + +set_version_in_file "plugins/gradle/example-client-kotlin/build.gradle" "id \"io.github.kobylynskyi.graphql.codegen\" version \"" +set_version_in_file "plugins/gradle/example-client-kotlin/build.gradle" "var graphqlCodegenClientKotlinVersion = '" +set_version_in_file "plugins/gradle/example-client-kotlin/build.gradle" "implementation \"io.github.kobylynskyi:graphql-java-codegen:" + +set_version_in_file "plugins/sbt/graphql-java-codegen-sbt-plugin/version.sbt" "version in ThisBuild := \"" + +set_version_in_file "plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/version.sbt" "version in ThisBuild := \"" +set_version_in_file "plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client/project/plugins.sbt" "graphql-codegen-sbt-plugin\" % \"" + +set_version_in_file "plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/version.sbt" "version in ThisBuild := \"" +set_version_in_file "plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/example-client-scala/project/plugins.sbt" "graphql-codegen-sbt-plugin\" % \"" + +set_version_in_file "plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/version.sbt" "version in ThisBuild := \"" +set_version_in_file "plugins/sbt/graphql-java-codegen-sbt-plugin/src/sbt-test/graphql-codegen-sbt-plugin/simple/project/plugins.sbt" "plugin.version\").orElse(Some(\"" + +# Exit clean +exit 0 diff --git a/scripts/update-release-version-in-readme.sh b/scripts/update-release-version-in-readme.sh new file mode 100755 index 0000000000000000000000000000000000000000..6fb499aac0f484cb3b478aa62bc1fd68e534890c --- /dev/null +++ b/scripts/update-release-version-in-readme.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +RELEASE_VERSION=$1 +RELEASE_VERSION_ESCAPED=${RELEASE_VERSION//./\\.} + +set_version_in_file() { + sed -i '' "s/$2[A-Z0-9.\-]*/$2$RELEASE_VERSION_ESCAPED/" "$1" + echo "Updated version in $1" +} + +set_version_in_file "plugins/gradle/README.md" "id \"io.github.kobylynskyi.graphql.codegen\" version \"" +set_version_in_file "plugins/gradle/README.md" "io.github.kobylynskyi.graphql.codegen:graphql-codegen-gradle-plugin:" +set_version_in_file "plugins/maven/README.md" "" + +# Exit clean +exit 0