-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d67ac6
commit 93032ff
Showing
9 changed files
with
9,400 additions
and
3,926 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: CI/CD Process | ||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [ windows-2022, macos-12, ubuntu-22.04 ] | ||
runs-on: ${{ matrix.os }} | ||
concurrency: | ||
group: build-${{ github.workflow }}-${{ matrix.os }}-${{ github.event.number || github.ref }} | ||
cancel-in-progress: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: DanySK/[email protected] | ||
with: | ||
# Dry-deployment | ||
check-command: ./gradlew build --parallel | ||
deploy-command: >- | ||
./gradlew | ||
uploadKotlinOSSRHToMavenCentralNexus | ||
uploadPluginMavenToMavenCentralNexus | ||
uploadPluginMarkerMavenToMavenCentralNexus | ||
close | ||
drop | ||
--parallel | ||
should-run-codecov: ${{ runner.os == 'Linux' }} | ||
should-deploy: >- | ||
${{ | ||
runner.os == 'Linux' | ||
&& !github.event.repository.fork | ||
&& github.event_name != 'pull_request' | ||
}} | ||
maven-central-username: nicolasfarabegoli | ||
maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | ||
signing-key: ${{ secrets.SIGNING_KEY }} | ||
signing-password: ${{ secrets.SIGNING_PASSWORD }} | ||
|
||
release: | ||
concurrency: | ||
# Only one release job at a time. Strictly sequential. | ||
group: release | ||
needs: | ||
- build | ||
runs-on: ubuntu-22.04 | ||
if: >- | ||
!github.event.repository.fork | ||
&& github.event_name != 'pull_request' | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
with: | ||
token: ${{ secrets.PERSONAL_TOKEN }} | ||
- name: Find the version of Node from package.json | ||
id: node-version | ||
run: echo "version=$(jq -r .engines.node package.json)" >> $GITHUB_OUTPUT | ||
- name: Install Node | ||
uses: actions/[email protected] | ||
with: | ||
node-version: ${{ steps.node-version.outputs.version }} | ||
- uses: DanySK/[email protected] | ||
with: | ||
build-command: true | ||
check-command: true | ||
deploy-command: | | ||
npm install | ||
npx semantic-release | ||
should-run-codecov: false | ||
should-deploy: true | ||
github-token: ${{ github.token }} | ||
gradle-publish-secret: ${{ secrets.GRADLE_PUBLISH_SECRET }} | ||
gradle-publish-key: ${{ secrets.GRADLE_PUBLISH_KEY }} | ||
maven-central-username: nicolasfarabegoli | ||
maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | ||
signing-key: ${{ secrets.SIGNING_KEY }} | ||
signing-password: ${{ secrets.SIGNING_PASSWORD }} | ||
|
||
success: | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- release | ||
- build | ||
if: >- | ||
always() && ( | ||
contains(join(needs.*.result, ','), 'failure') | ||
|| !contains(join(needs.*.result, ','), 'cancelled') | ||
) | ||
steps: | ||
- name: Verify that there were no failures | ||
run: ${{ !contains(join(needs.*.result, ','), 'failure') }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: CI/CD | ||
on: | ||
push: | ||
branches-ignore: | ||
- 'dependabot/**' | ||
paths-ignore: | ||
- '.gitignore' | ||
- '.mergify.yml' | ||
- 'CHANGELOG.md' | ||
- 'LICENSE' | ||
- 'README.md' | ||
- 'renovate.json' | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
dispatcher: | ||
runs-on: ubuntu-22.04 | ||
if: >- | ||
github.event_name != 'pull_request' | ||
|| github.event.pull_request.head.repo.full_name != github.repository | ||
|| startsWith(github.head_ref, 'dependabot/') | ||
steps: | ||
- run: 'true' | ||
ci-cd: | ||
needs: | ||
- dispatcher | ||
uses: ./.github/workflows/build-and-deploy.yml | ||
secrets: inherit |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat | ||
import org.gradle.api.tasks.testing.logging.TestLogEvent | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
import org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION as KOTLIN_VERSION | ||
|
||
@Suppress("DSL_SCOPE_VIOLATION") | ||
plugins { | ||
|
@@ -9,17 +10,23 @@ plugins { | |
alias(libs.plugins.dokka) | ||
alias(libs.plugins.detekt) | ||
alias(libs.plugins.ktlint) | ||
alias(libs.plugins.publish.central) | ||
alias(libs.plugins.publishOnCentral) | ||
alias(libs.plugins.gitSemVer) | ||
alias(libs.plugins.publish) | ||
alias(libs.plugins.conventional.commits) | ||
} | ||
|
||
group = "it.nicolasfarabegoli" | ||
val projectId = "$group.$name" | ||
val fullName = "Configure conventional commit" | ||
val websiteUrl = "https://github.com/nicolasfara/conventional-commits" | ||
val projectDetail = "Plugin to check if commits are 'Conventional Commits' compliant" | ||
val pluginImplementationClass = "it.nicolasfarabegoli.gradle.ConventionalCommits" | ||
description = "Plugin to check if commits are 'Conventional Commits' compliant" | ||
inner class ProjectInfo { | ||
val longName = "Template for Gradle Plugins" | ||
val website = "https://github.com/nicolasfara/conventional-commits" | ||
val vcsUrl = "$website.git" | ||
val scm = "scm:git:$website.git" | ||
val pluginImplementationClass = "$group.gradle.ConventionalCommits" | ||
val tags = listOf("conventional-commit") | ||
} | ||
val info = ProjectInfo() | ||
|
||
repositories { | ||
mavenCentral() | ||
|
@@ -54,29 +61,59 @@ tasks.withType<Test> { | |
} | ||
|
||
gradlePlugin { | ||
website.set(websiteUrl) | ||
vcsUrl.set(websiteUrl) | ||
plugins { | ||
create("ConventionalCommits") { | ||
id = projectId | ||
displayName = fullName | ||
description = projectDetail | ||
implementationClass = pluginImplementationClass | ||
website.set(info.website) | ||
vcsUrl.set(info.vcsUrl) | ||
create("") { | ||
id = "$group.${project.name}" | ||
displayName = info.longName | ||
description = project.description | ||
implementationClass = info.pluginImplementationClass | ||
tags.set(info.tags) | ||
} | ||
} | ||
} | ||
|
||
// Enforce Kotlin version coherence | ||
configurations.all { | ||
resolutionStrategy.eachDependency { | ||
if (requested.group == "org.jetbrains.kotlin" && requested.name.startsWith("kotlin")) { | ||
useVersion(KOTLIN_VERSION) | ||
because("All Kotlin modules should use the same version, and compiler uses $KOTLIN_VERSION") | ||
} | ||
} | ||
} | ||
|
||
publishOnMavenCentral { | ||
projectDescription.set(projectDetail) | ||
signing { | ||
if (System.getenv()["CI"].equals("true", ignoreCase = true)) { | ||
val signingKey: String? by project | ||
val signingPassword: String? by project | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
} | ||
} | ||
|
||
/* | ||
* Publication on Maven Central and the Plugin portal | ||
*/ | ||
publishOnCentral { | ||
projectLongName.set(info.longName) | ||
projectDescription.set(description ?: TODO("Missing description")) | ||
projectUrl.set(info.website) | ||
scmConnection.set(info.scm) | ||
publishing { | ||
publications { | ||
withType<MavenPublication> { | ||
pom { | ||
scm { | ||
connection.set("git:[email protected]:nicolasfara/${rootProject.name}") | ||
developerConnection.set("git:[email protected]:nicolasfara/${rootProject.name}") | ||
url.set("https://github.com/nicolasfara/${rootProject.name}") | ||
} | ||
developers { | ||
developer { | ||
name.set("Nicolas Farabegoli") | ||
email.set("[email protected]") | ||
url.set("https://github.com/nicolasfara") | ||
url.set("https://www.nicolasfarabegoli.it/") | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.