From 93f0c4ce595dcc388b336fb185434c53695c911c Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Thu, 4 Mar 2021 19:04:23 +0530 Subject: [PATCH 1/2] Create projectVersion gradle property --- build.gradle | 2 +- gradle.properties | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5eab5f45..f684f010 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ buildscript { logger.lifecycle "GORM VERSION = ${project.datastoreVersion}" group "org.grails" -version "7.0.2.BUILD-SNAPSHOT" +version project.projectVersion ext { isTravisBuild = System.getenv().get("TRAVIS") == 'true' diff --git a/gradle.properties b/gradle.properties index 36a5c227..8dc73ede 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,6 +8,7 @@ mongodbDriverVersion=3.10.0 mongodbRxDriverVersion=1.10.0 mongoJavaServerVersion=1.9.8 hibernateValidatorVersion=6.0.13.Final +projectVersion=7.0.2.BUILD-SNAPSHOT spockVersion=1.2-groovy-2.5 assetPipelineVersion=3.0.7 gebVersion=2.3 From 4c2cebe03d594b22d2fbf86bdb457c07dcb63fb6 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Fri, 5 Mar 2021 14:09:27 +0530 Subject: [PATCH 2/2] Copy Github Workflow --- .github/release-drafter.yml | 26 ++++++++ .github/workflows/gradle.yml | 92 +++++++++++++++++++++++++++++ .github/workflows/release-notes.yml | 43 ++++++++++++++ .github/workflows/release.yml | 90 ++++++++++++++++++++++++++++ 4 files changed, 251 insertions(+) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/gradle.yml create mode 100644 .github/workflows/release-notes.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..0370648f --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,26 @@ +name-template: $NEXT_PATCH_VERSION +tag-template: v$NEXT_PATCH_VERSION +categories: + - title: 🚀 Features + labels: + - "type: enhancement" + - "type: new feature" + - "type: major" + - title: 🚀 Bug Fixes/Improvements + labels: + - "type: improvement" + - "type: bug" + - "type: minor" + - title: 🛠 Dependency upgrades + labels: + - "type: dependency-upgrade" + - "dependencies" +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +template: | + ## Changes + + $CHANGES + + ## Contributors + + $CONTRIBUTORS diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 00000000..ae016742 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,92 @@ +name: Java CI +on: + push: + branches: + - master + - '[7-9]+.[0-9]+.x' + pull_request: + branches: + - master + - '[7-9]+.[0-9]+.x' + workflow_dispatch: + inputs: + message: + description: 'Snapshot information (e.g. New Core Snapshot Tue Dec 15 00:07:18 UTC 2020 f212f54)' + required: true +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + java: ['8', '11'] + mongodb-version: ['3.6'] + env: + WORKSPACE: ${{ github.workspace }} + GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8 + steps: + - name: Print Dispatch Information + if: github.event_name == 'workflow_dispatch' + env: + DISPATCH_INFORMATION: ${{ github.event.inputs.message }} + run: echo $DISPATCH_INFORMATION + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + - name: Optional setup step + run: | + [ -f ./setup.sh ] && ./setup.sh || true + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.3.0 + with: + mongodb-version: ${{ matrix.mongodb-version }} + - name: Compile and Run Tests + run: | + ./gradlew compileGroovy --no-daemon + ./gradlew compileTestGroovy --no-daemon + ./gradlew -Dgeb.env=chromeHeadless check --no-daemon + - name: Publish Test Report + uses: scacap/action-surefire-report@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + report_paths: '**/build/test-results/test/TEST-*.xml' + - name: Publish to repo.grails.org + if: success() && github.event_name == 'push' && matrix.java == '8' + env: + SECRING_FILE: ${{ secrets.SECRING_FILE }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} + ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} + ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + run: | + echo $SECRING_FILE | base64 -d > secring.gpg + ./gradlew -Dorg.gradle.internal.publish.checksums.insecure=true -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="secring.gpg" publish + echo "Publishing Documentation..." + ./gradlew docs:docs + - name: Determine docs target repository + if: success() && github.event_name == 'push' && matrix.java == '8' + uses: haya14busa/action-cond@v1 + id: docs_target + with: + cond: ${{ github.repository == 'grails/gorm-mongodb' }} + if_true: "grails/grails-data-mapping" + if_false: ${{ github.repository }} + - name: Publish to Github Pages + if: success() && github.event_name == 'push' && matrix.java == '8' + uses: micronaut-projects/github-pages-deploy-action@master + env: + TARGET_REPOSITORY: ${{ steps.docs_target.outputs.value }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + BRANCH: gh-pages + FOLDER: docs/build/docs + DOC_SUB_FOLDER: mongodb + DOC_FOLDER: gh-pages + COMMIT_EMAIL: behlp@objectcomputing.com + COMMIT_NAME: Puneet Behl diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml new file mode 100644 index 00000000..89f1e20e --- /dev/null +++ b/.github/workflows/release-notes.yml @@ -0,0 +1,43 @@ +name: Changelog +on: + issues: + types: [closed,reopened] + push: + branches: + - master + - '[7-9]+.[0-9]+.x' +jobs: + release_notes: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check if it has release drafter config file + id: check_release_drafter + run: | + has_release_drafter=$([ -f .github/release-drafter.yml ] && echo "true" || echo "false") + echo ::set-output name=has_release_drafter::${has_release_drafter} + + # If it has release drafter: + - uses: release-drafter/release-drafter@v5 + if: steps.check_release_drafter.outputs.has_release_drafter == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + # Otherwise: + - name: Export Gradle Properties + if: steps.check_release_drafter.outputs.has_release_drafter == 'false' + uses: micronaut-projects/github-actions/export-gradle-properties@master + - uses: micronaut-projects/github-actions/release-notes@master + if: steps.check_release_drafter.outputs.has_release_drafter == 'false' + id: release_notes + with: + token: ${{ secrets.GH_TOKEN }} + - uses: ncipollo/release-action@v1 + if: steps.check_release_drafter.outputs.has_release_drafter == 'false' && steps.release_notes.outputs.generated_changelog == 'true' + with: + allowUpdates: true + commit: ${{ steps.release_notes.outputs.current_branch }} + draft: true + name: ${{ env.title }} ${{ steps.release_notes.outputs.next_version }} + tag: v${{ steps.release_notes.outputs.next_version }} + bodyFile: CHANGELOG.md + token: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..0a187dc2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,90 @@ +name: Release +on: + release: + types: [published] +jobs: + release: + runs-on: ubuntu-latest + strategy: + matrix: + java: ['8'] + env: + GIT_USER_NAME: puneetbehl + GIT_USER_EMAIL: behlp@objectcomputing.com + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + token: ${{ secrets.GH_TOKEN }} + - uses: gradle/wrapper-validation-action@v1 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + - name: Set the current release version + id: release_version + run: echo ::set-output name=release_version::${GITHUB_REF:11} + - name: Run pre-release + uses: micronaut-projects/github-actions/pre-release@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Publish, Upload to Bintray + env: + BINTRAY_USER: ${{ secrets.BINTRAY_USER }} + BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} + ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} + run: | + echo "Publishing Artifacts" + ./gradlew bintrayUpload + echo "Publishing Documentation" + ./gradlew docs:docs + - name: Export Gradle Properties + uses: micronaut-projects/github-actions/export-gradle-properties@master + - name: Determine docs target repository + if: success() + uses: haya14busa/action-cond@v1 + id: docs_target + with: + cond: ${{ github.repository == 'grails/gorm-mongodb' }} + if_true: "grails/grails-data-mapping" + if_false: ${{ github.repository }} + - name: Publish to Github Pages + if: success() + uses: micronaut-projects/github-pages-deploy-action@master + env: + BETA: ${{ contains(steps.release_version.outputs.release_version, 'M') || contains(steps.release_version.outputs.release_version, 'RC') }} + TARGET_REPOSITORY: ${{ steps.docs_target.outputs.value }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + BRANCH: gh-pages + FOLDER: docs/build/docs + DOC_SUB_FOLDER: mongodb + DOC_FOLDER: gh-pages + COMMIT_EMAIL: behlp@objectcomputing.com + COMMIT_NAME: Puneet Behl + VERSION: ${{ steps.release_version.outputs.release_version }} + - name: Create Message for the Maven Central Sync + if: success() + id: maven_sync_message + run: | + echo ::set-output name=value::{\"release_version\":\"$RELEASE_VERSION\"} + env: + RELEASE_VERSION: ${{ steps.release_version.outputs.release_version }} + - name: Invoke the Maven Central Sync workflow + if: success() + uses: benc-uk/workflow-dispatch@v1.1 + with: + workflow: Maven Central Sync + ref: master + token: ${{ secrets.GH_TOKEN }} + inputs: ${{ steps.maven_sync_message.outputs.value }} + - name: Run post-release + if: success() + uses: micronaut-projects/github-actions/post-release@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + env: + SNAPSHOT_SUFFIX: .BUILD-SNAPSHOT