diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index cc71c36c..3187a787 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -1,40 +1,40 @@ -name: CI +name: CI/CD Process on: - push: - tags: '*' - branches-ignore: - - 'autodelivery**' - - 'bump-**' - - 'renovate/**' - paths-ignore: - - 'CHANGELOG.md' - - 'LICENSE' - - 'README.md' - - 'renovate.json' - pull_request: + workflow_call: workflow_dispatch: jobs: - Build: + build: strategy: matrix: os: [windows, macos, ubuntu] runs-on: ${{ matrix.os }}-latest - concurrency: - group: ${{ github.workflow }}-${{ matrix.os }}-${{ github.event.number || github.ref }} - cancel-in-progress: true steps: - name: Checkout uses: DanySK/action-checkout@0.2.1 - - uses: DanySK/build-check-deploy-gradle-action@2.1.0 + - uses: DanySK/build-check-deploy-gradle-action@2.0.2 with: + deploy-command: >- + ./gradlew + uploadKotlin + uploadPluginMavenToMavenCentralNexus + uploadGitHooksPluginMarkerMavenToMavenCentralNexus + close + --parallel should-run-codecov: ${{ runner.os == 'Linux' }} - should-deploy: false - Release: + should-deploy: >- + ${{ + runner.os == 'Linux' + && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) + }} + maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + signing-key: ${{ secrets.SIGNING_KEY }} + signing-password: ${{ secrets.SIGNING_PASSWORD }} + release: needs: - - Build + - build runs-on: ubuntu-latest - if: github.event_name == 'push' + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository concurrency: group: release steps: @@ -42,7 +42,7 @@ jobs: uses: actions/checkout@v3.0.2 with: token: ${{ secrets.DEPLOYMENT_TOKEN }} - - uses: DanySK/build-check-deploy-gradle-action@2.1.0 + - uses: DanySK/build-check-deploy-gradle-action@2.0.2 with: build-command: true check-command: true @@ -51,9 +51,23 @@ jobs: npx semantic-release should-run-codecov: false should-deploy: true + should-validate-wrapper: false github-token: ${{ github.token }} gradle-publish-secret: ${{ secrets.GRADLE_PUBLISH_SECRET }} gradle-publish-key: ${{ secrets.GRADLE_PUBLISH_KEY }} maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} signing-key: ${{ secrets.SIGNING_KEY }} signing-password: ${{ secrets.SIGNING_PASSWORD }} + success: + runs-on: ubuntu-latest + needs: + - build + - release + if: >- + always() && ( + contains(join(needs.*.result, ','), 'failure') + || !contains(join(needs.*.result, ','), 'cancelled') + ) + steps: + - name: Verify that the workflow executed and there were no failures + run: ${{ !contains(join(needs.*.result, ','), 'failure') }} diff --git a/.github/workflows/dispatcher.yml b/.github/workflows/dispatcher.yml new file mode 100644 index 00000000..b0efd553 --- /dev/null +++ b/.github/workflows/dispatcher.yml @@ -0,0 +1,28 @@ +name: CI/CD +on: + push: + branches-ignore: + - 'dependabot/**' + paths-ignore: + - '.gitignore' + - 'CHANGELOG.md' + - 'LICENSE' + - 'README.md' + - 'renovate.json' + pull_request: + workflow_dispatch: + +jobs: + dispatcher: + runs-on: ubuntu-latest + if: >- + github.event_name != 'pull_request' + || github.event.pull_request.head.repo.full_name != github.repository + || startsWith(github.head_ref, 'refs/heads/dependabot/') + steps: + - run: 'true' + ci-cd: + needs: + - dispatcher + uses: ./.github/workflows/build-and-deploy.yml + secrets: inherit diff --git a/build.gradle.kts b/build.gradle.kts index f555cfc0..da557d6f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -153,7 +153,7 @@ pluginBundle { gradlePlugin { plugins { - create("plugin-template") { + create("gitHooks") { id = "$group.${project.name}" displayName = info.longName description = project.description diff --git a/release.config.js b/release.config.js index cd9a9bab..7379e224 100644 --- a/release.config.js +++ b/release.config.js @@ -1,8 +1,15 @@ var publishCmd = ` git tag -a -f \${nextRelease.version} \${nextRelease.version} -F CHANGELOG.md git push --force origin \${nextRelease.version} -./gradlew releaseKotlinMavenOnMavenCentralNexus || exit 1 -./gradlew publishPlugins -Pgradle.publish.key=$GRADLE_PUBLISH_KEY -Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET || exit 2 +./gradlew \ + uploadKotlin \ + uploadPluginMavenToMavenCentralNexus \ + uploadGitHooksPluginMarkerMavenToMavenCentralNexus \ + release || exit 1 +./gradlew \ + publishPlugins \ + -Pgradle.publish.key=$GRADLE_PUBLISH_KEY \ + -Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET || exit 2 ./gradlew publishKotlinMavenPublicationToGithubRepository || true ` var config = require('semantic-release-preconfigured-conventional-commits');