diff --git a/plugins/maven/README.md b/plugins/maven/README.md index 22e9d8eca..7456a5f95 100644 --- a/plugins/maven/README.md +++ b/plugins/maven/README.md @@ -6,7 +6,7 @@ Release a Java project to a [maven](https://maven.apache.org/) instance. This plugin is not included with the `auto` CLI installed via NPM. To install: -```sh +```shell script npm i --save-dev @auto-it/maven # or yarn add -D @auto-it/maven @@ -20,6 +20,15 @@ yarn add -D @auto-it/maven } ``` +## Environment Variables + +| Name | Description | Default value | +| ----------------------- | ------------------------------------------------------------------------------------------------ | -------------- | +| `MAVEN_USERNAME` | The deploy username used to login to the repository. | `null` | +| `MAVEN_PASSWORD` | The deploy password used to login to the repository. | `null` | +| `MAVEN_SETTINGS` | The maven `settings.xml` file used by maven. | `null` | +| `MAVEN_SNAPSHOT_BRANCH` | The branch on which the `SNAPSHOT` version lives. Must be different than the Auto "base branch." | `dev-snapshot` | + ## Maven Project Configuration Your project must be using the maven release plugin. Make sure the the latest `maven-release-plugin` is in your `pom.xml`. @@ -33,39 +42,39 @@ Your project must be using the maven release plugin. Make sure the the latest `m initialize deploy - ``` -You will also need all of the following configuration blocks for all parts of `auto` to function: +You will also need all the following configuration blocks for all parts of `auto` to function: 1. Author - ```xml - - - Andrew Lisowski - test@email.com - - - ``` +```xml + + + Andrew Lisowski + test@email.com + + +``` 2. SCM - ```xml - - scm:git:https://${env.GH_USER}:${env.GH_TOKEN}@github.com/Fuego-Tools/java-test-project.git - scm:git:https://${env.GH_USER}:${env.GH_TOKEN}@github.com/Fuego-Tools/java-test-project.git - https://github.com/Fuego-Tools/java-test-project - HEAD - - ``` +```xml + + scm:git:https://${env.GH_USER}:${env.GH_TOKEN}@github.com/Fuego-Tools/java-test-project.git + scm:git:https://${env.GH_USER}:${env.GH_TOKEN}@github.com/Fuego-Tools/java-test-project.git + https://github.com/Fuego-Tools/java-test-project + HEAD + +``` - ::: message is-info - Don't forget to set enviornment variables `GH_USER`, `GH_TOKEN` - ::: +::: message is-info +Don't forget to set enviornment variables `GH_USER`, `GH_TOKEN` +::: 3. Version - ```xml - 1.0.0-SNAPSHOT - ``` +```xml +1.0.0-SNAPSHOT +``` diff --git a/plugins/maven/src/index.ts b/plugins/maven/src/index.ts index f50df07a9..ec7355a43 100644 --- a/plugins/maven/src/index.ts +++ b/plugins/maven/src/index.ts @@ -171,9 +171,11 @@ export default class MavenPlugin implements IPlugin { }); auto.hooks.afterShipIt.tapPromise(this.name, async () => { + const { MAVEN_SNAPSHOT_BRANCH } = process.env; + const mavenSnapshotBranch = MAVEN_SNAPSHOT_BRANCH || "dev-snapshot"; // prepare for next development iteration - await execPromise("git", ["reset", "--hard", "dev-snapshot"]); - await execPromise("git", ["branch", "-d", "dev-snapshot"]); + await execPromise("git", ["reset", "--hard", mavenSnapshotBranch]); + await execPromise("git", ["branch", "-d", mavenSnapshotBranch]); await execPromise("git", ["push", auto.remote, auto.baseBranch]); }); }