diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000..4671a1fb --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,10 @@ +# This configuration file was automatically generated by Gitpod. +# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml) +# and commit this file to your remote git repository to share the goodness with others. + +# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart + +tasks: + - init: npm install + + diff --git a/README.md b/README.md index 314b455c..917ddaf5 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,12 @@ This plugin updates `gradle.properties` to bump up project version. If you want }, ``` +### Options + +| Options | Description | Default | +| ------------ | ----------------- | ------------------------ | +| `gradlePublish` | Whether to publish the `gradle` package to the registry. If `false` the `gradle.properties` version will still be updated. | `true` | + # Gradle Properties ## Publish Properties diff --git a/package-lock.json b/package-lock.json index b35706ce..eeb06cf1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ ], "license": "MIT", "dependencies": { + "lodash-es": "^4.17.21", "promisified-properties": "^3.0.0", "split2": "^4.1.0" }, @@ -6361,8 +6362,7 @@ "node_modules/lodash-es": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", - "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", - "dev": true + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" }, "node_modules/lodash.capitalize": { "version": "4.2.1", @@ -16242,8 +16242,7 @@ "lodash-es": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", - "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", - "dev": true + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" }, "lodash.capitalize": { "version": "4.2.1", diff --git a/package.json b/package.json index faad1c6d..e111cfb2 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "prepare": "husky" }, "dependencies": { + "lodash-es": "^4.17.21", "promisified-properties": "^3.0.0", "split2": "^4.1.0" }, diff --git a/src/definition.ts b/src/definition.ts index 29708c73..e6c6a7c5 100644 --- a/src/definition.ts +++ b/src/definition.ts @@ -10,6 +10,10 @@ export interface INextRelease extends ILastRelease { notes: string; } +export interface Options { + gradlePublish: boolean; +} + /** * The context object defined in semantic-release/index.js * @see https://github.com/semantic-release/semantic-release/blob/v15.13.3/index.js @@ -24,7 +28,7 @@ export interface IContext { // https://nodejs.org/docs/latest-v8.x/api/process.html#process_process_stderr stderr: WritableStream; // https://github.com/semantic-release/semantic-release/blob/v15.13.3/lib/get-config.js - options: object; + options: Options; nextRelease: INextRelease; logger: Signale; } diff --git a/src/publish.ts b/src/publish.ts index 87532ea4..a2fe2a59 100644 --- a/src/publish.ts +++ b/src/publish.ts @@ -1,10 +1,12 @@ -import { IContext } from "./definition"; +import { IContext, Options } from "./definition"; import { publishArtifact } from "./gradle"; module.exports = async function publish( - pluginConfig: object, + pluginConfig: Options, context: IContext, ) { - const { cwd, env, logger } = context; - await publishArtifact(cwd, env as NodeJS.ProcessEnv, logger); + if (pluginConfig.gradlePublish !== false) { + const { cwd, env, logger } = context; + await publishArtifact(cwd, env as NodeJS.ProcessEnv, logger); + } };