Skip to content

Commit

Permalink
ci: add dry-deployment test and fix the release process for publish-o…
Browse files Browse the repository at this point in the history
…n-central 2.x.x
  • Loading branch information
DanySK committed Jul 2, 2022
1 parent f12e285 commit 75553d4
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 26 deletions.
60 changes: 37 additions & 23 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
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:
- name: Checkout
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
Expand All @@ -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') }}
28 changes: 28 additions & 0 deletions .github/workflows/dispatcher.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pluginBundle {

gradlePlugin {
plugins {
create("plugin-template") {
create("gitHooks") {
id = "$group.${project.name}"
displayName = info.longName
description = project.description
Expand Down
11 changes: 9 additions & 2 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down

0 comments on commit 75553d4

Please sign in to comment.