Skip to content

Commit

Permalink
markdown lint
Browse files Browse the repository at this point in the history
  • Loading branch information
bgalek committed Aug 25, 2024
1 parent 2508725 commit 67cb348
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 155 deletions.
30 changes: 15 additions & 15 deletions docs/configuration/basic_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ Sometimes it might be desirable to release each module (or just some
modules) of multi-module project separately. If so, please make sure
that:

- keep in mind, that `scmVersion` must be initialized before
`scmVersion.version` is accessed
- apply plugin on each module that should be released on its own
- keep in mind, that `scmVersion` must be initialized before
`scmVersion.version` is accessed
- apply plugin on each module that should be released on its own

The plugin ignores tags based on the prefix and version separator
(i.e. `<prefix><separator>`). If there is a prefix configured then
(i.e. `<prefix><separator>`). If there is a prefix configured then
tags that do not start with the configured `<prefix><separator>` are
all ignored. If there is no prefix configured then only tags matching
the version are used for calculating the version (i.e. the version
Expand All @@ -98,10 +98,10 @@ This allows for using the name of the module with an appropriate version
separator as a namespace in a multi-module project, as shown in the table
below:

| Module name | Version separator | Tags will appear as |
|-------------|-------------------|---------------------|
| `module` | `-` | `module-<maj>.<min>.<patch>` |
| `moduleV2` | `-` | `moduleV2-<maj>.<min>.<patch>` |
| Module name | Version separator | Tags will appear as |
|-------------|-------------------|--------------------------------|
| `module` | `-` | `module-<maj>.<min>.<patch>` |
| `moduleV2` | `-` | `moduleV2-<maj>.<min>.<patch>` |

For example, within `module`, tags that do not start `module-` will be
ignored.
Expand All @@ -119,7 +119,7 @@ my-service-client

Use the `exclude()` configuration parameter within a `monorepo` block to identify submodules
that should be excluded from consideration when calculating whether to increment
the version of the parent project. Typically, you would do this in the top level
the version of the parent project. Typically, you would do this in the top level
project, assuming that submodules are named after the directory they appear in:

```
Expand All @@ -138,7 +138,6 @@ increment to the version of `A` even if its code did not change, but we only had

Note: these values need to be relative to project root


```
scmVersion {
monorepo {
Expand All @@ -151,15 +150,16 @@ scmVersion {
```

Version calculation rules:

1. Changes to files within a submodule increment that submodule's version only.
2. Changes to a submodule do not cause a change to the parent project's version if
the parent is set to ignore that submodule, via `exclude()`.
the parent is set to ignore that submodule, via `exclude()`.
3. Changes to files in the parent project but which are not in a submodule identified via
`exclude()` will cause the parent project's version to increment but not the
versions of any submodules. If this is desired then consider wiring the `createRelease` or
`release` tasks of the submodules to be dependencies of the tasks of the same name in the parent.
`exclude()` will cause the parent project's version to increment but not the
versions of any submodules. If this is desired then consider wiring the `createRelease` or
`release` tasks of the submodules to be dependencies of the tasks of the same name in the parent.
4. Changes to directories provided with `include` configuration will also cause an
incrementation of version (even if the main module did not have any changes)
incrementation of version (even if the main module did not have any changes)

## Releasing

Expand Down
27 changes: 15 additions & 12 deletions docs/configuration/ci_servers.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ To enable it, use:

This behavior is experimental and has been tested on the following CI servers:

- GitHub Actions
- GitHub Actions

## GitHub Actions

`axion-release` has dedicated support for GitHub Actions and you don't need any custom configs to make it working.

Here's what Axion does for you under the hood:

- gets the original branch name for workflows triggered by `pull_request` - see [versionWithBranch](version.md#versionwithbranch-default)
- gets the original branch name for workflows triggered by `pull_request` -
see [versionWithBranch](version.md#versionwithbranch-default)

## Jenkins

Expand Down Expand Up @@ -65,11 +66,11 @@ that behaviour will enable fetching of tags.
Bamboo fetches bare minimum of information from git. By default, it
won't even fetch tags. To change this:

- go to plan configuration
- open *Repositories* tab
- choose code repository
- open *Advanced options*
- disable *Use shallow clones* option
- go to plan configuration
- open *Repositories* tab
- choose code repository
- open *Advanced options*
- disable *Use shallow clones* option

### Attach remote on build

Expand Down Expand Up @@ -115,22 +116,24 @@ you need to override branch name with `overriddenBranchName` flag and set it to

## GitLab CI

If you set up a [project token](https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html) you can easily add a non-user dependent tag stage. Add the project token and token user bot name as CI-variables, accessible to the build script.
If you set up a [project token](https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html) you can
easily add a non-user dependent tag stage. Add the project token and token user bot name as CI-variables, accessible to
the build script.

Example:


tagging:
stage: tag
image: ....
script:
- git remote set-url origin ${CI_SERVER_URL}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}.git
- ./gradlew release -Prelease.disableChecks -Prelease.pushTagsOnly -Prelease.overriddenBranchName=${CI_COMMIT_REF_SLUG} -Prelease.customUsername=${PROJECT_ACCESS_TOKEN_BOT_NAME} -Prelease.customPassword=${PROJECT_ACCESS_TOKEN}

NOTE: You need to set the git remote url first, as GitLab's default cloned project url will have added the non repo-write permission [gitlab-ci-token](https://docs.gitlab.com/ee/ci/jobs/ci_job_token.html) to the origin url.

NOTE: You need to set the git remote url first, as GitLab's default cloned project url will have added the non
repo-write permission [gitlab-ci-token](https://docs.gitlab.com/ee/ci/jobs/ci_job_token.html) to the origin url.

Disabling checks is necessary because `axion-release` is not able to verify if current commit is ahead of remote.
Setting pushTagsOnly ensures that git will not throw an error by attempting to push commits while not working on a branch.
Setting pushTagsOnly ensures that git will not throw an error by attempting to push commits while not working on a
branch.

Since Gitlab will do a detached head checkout, the branch name has to be overridden when `versionWithBranch` is used.
29 changes: 15 additions & 14 deletions docs/configuration/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ Supported arguments:

- file - path to file in form of string or `File` instance to update
- files - array of files, takes precedence over single file definition
if not empty
if not empty
- pattern - closure that should return String pattern, arguments are
**previous version** and context (described below)
**previous version** and context (described below)
- replacement - closure that should return replacement, arguments are
**current version** and context
**current version** and context
- encoding - the name of encoding to use during processing the specified files.
By default, it uses default JVM encoding (described below)
By default, it uses default JVM encoding (described below)

All patterns have multiline flag switched on by default to match against
content of whole file.
Expand Down Expand Up @@ -101,13 +101,14 @@ any closure that accepts `HookContext` object:

`HookContext` object fields and methods:

- *logger* - instance of Gradle project logger
- *position* - [ScmPosition](https://github.com/allegro/axion-release-plugin/blob/master/src/main/java/pl/allegro/tech/build/axion/release/domain/scm/ScmPosition.java)
- *previousVersion* - version before release
- *currentVersion* - released version
- *readVersion()* - force reevaluation of version, returns fresh
version as if called `./gradlew currentVersion` command
- *commit(List patterns, String message)* - force commit of given
patterns with message
- *addCommitPattern(String pattern)* - add pattern to commit, you can
commit everything at once by adding commit hook to the chain
- *logger* - instance of Gradle project logger
-
*position* - [ScmPosition](https://github.com/allegro/axion-release-plugin/blob/master/src/main/java/pl/allegro/tech/build/axion/release/domain/scm/ScmPosition.java)
- *previousVersion* - version before release
- *currentVersion* - released version
- *readVersion()* - force reevaluation of version, returns fresh
version as if called `./gradlew currentVersion` command
- *commit(List patterns, String message)* - force commit of given
patterns with message
- *addCommitPattern(String pattern)* - add pattern to commit, you can
commit everything at once by adding commit hook to the chain
7 changes: 4 additions & 3 deletions docs/configuration/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

All `axion-release-plugin` configuration options:


scmVersion {

repository {
Expand Down Expand Up @@ -99,8 +98,10 @@ All `axion-release-plugin` configuration flags:
- release.overriddenIsClean
- default: not set = determine the `isClean`-state
- possible values: `true` or `false`
- usually the plugin performs a check if the working directory is clean. With this flag, the result of the check can be overridden.
- If you have a repository with a lot of files and do not use the isClean-feature, you may set this flag for a speed-up.
- usually the plugin performs a check if the working directory is clean. With this flag, the result of the check can
be overridden.
- If you have a repository with a lot of files and do not use the isClean-feature, you may set this flag for a
speed-up.
- release.disableSshAgent
- default: false
- do not use the ssh agent
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/resolving_dependency_conflicts.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Resolving dependency conflicts

`axion-release-plugin` uses [JGit](https://www.eclipse.org/jgit/) and [JSch](http://www.jcraft.com/jsch/)
under the hood. Other Gradle plugins can have version conflicts with those dependencies.
under the hood. Other Gradle plugins can have version conflicts with those dependencies.

In order to resolve such conflicts specify dependency explicitly. Eg. for JGit:

Expand Down
12 changes: 6 additions & 6 deletions docs/configuration/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

`axion-gradle-plugin` adds 6 new Gradle tasks:

- *verifyRelease*
- *release*
- *createRelease*
- *pushRelease*
- *currentVersion*
- *markNextVersion*
- *verifyRelease*
- *release*
- *createRelease*
- *pushRelease*
- *currentVersion*
- *markNextVersion*

## verifyRelease

Expand Down
68 changes: 38 additions & 30 deletions docs/configuration/version.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
parsing and decorating. Extracting version information from repository
can be split in six phases:

- reading - read tags from repository
- parsing - extracting version from tag (serializing version to tag)
- incrementing - when not on tag, version patch (least significant)
number is incremented
- decorating - adding additional transformations to create final
version
- appending snapshot - when not on tag, -SNAPSHOT suffix is appended (can be customized)
- sanitization - making sure there are no unwanted characters in
version
- reading - read tags from repository
- parsing - extracting version from tag (serializing version to tag)
- incrementing - when not on tag, version patch (least significant)
number is incremented
- decorating - adding additional transformations to create final
version
- appending snapshot - when not on tag, -SNAPSHOT suffix is appended (can be customized)
- sanitization - making sure there are no unwanted characters in
version

## Reading

Expand All @@ -33,7 +33,9 @@ calculating current version. Prefix can be set using

Default prefix is `v`.

In case a tag does not match the main prefix, fallback prefixes will be examined. You can use fallback prefixes to migrate from one prefix to another. For example, if you use prefix `my-service-` but want to migrate to prefix `v`, you can configure it like that:
In case a tag does not match the main prefix, fallback prefixes will be examined. You can use fallback prefixes to
migrate from one prefix to another. For example, if you use prefix `my-service-` but want to migrate to prefix `v`, you
can configure it like that:

scmVersion {
tag {
Expand All @@ -42,7 +44,8 @@ In case a tag does not match the main prefix, fallback prefixes will be examined
}
}

Axion will use fallback prefixes to calculate latest version, but the next release tag will be created using the main prefix.
Axion will use fallback prefixes to calculate latest version, but the next release tag will be created using the main
prefix.

There is also an option to set prefix per-branch (i.e. to use different
version prefix on `legacy-` branches):
Expand Down Expand Up @@ -149,12 +152,12 @@ deserialization config object and position in SCM:
`config` object is instance of `TagNameSerializationRules` class. Useful
properties are:

- `prefix`: tag prefix
- `separator`: separator between prefix and version
- `prefix`: tag prefix
- `separator`: separator between prefix and version

`position` object contains:

- `branch` - the name of the current branch
- `branch` - the name of the current branch

Last but not least, `tagName` contains prepared tag name that should be
used to extract version. `position.latestTag` might point to next
Expand Down Expand Up @@ -200,13 +203,14 @@ Incrementing phase does increment the version in accordance with
*version incrementer*. By default, version patch (least significant)
number is incremented. There are other predefined rules:

- *incrementPatch* - increment patch number
- *incrementMinor* - increment minor (middle) number
- *incrementMajor* - increment major number
- *incrementMinorIfNotOnRelease* - increment patch number if on
release branch. Increment minor otherwise
- *incrementPrerelease* - increment pre-release suffix if possible
(-rc1 to -rc2). Add `initialPreReleaseIfNotOnPrerelease` to increment patch with pre-release version. Increment patch otherwise
- *incrementPatch* - increment patch number
- *incrementMinor* - increment minor (middle) number
- *incrementMajor* - increment major number
- *incrementMinorIfNotOnRelease* - increment patch number if on
release branch. Increment minor otherwise
- *incrementPrerelease* - increment pre-release suffix if possible
(-rc1 to -rc2). Add `initialPreReleaseIfNotOnPrerelease` to increment patch with pre-release version. Increment patch
otherwise

You can set one of predefined rules via `scmVersion.versionIncrementer`
method:
Expand Down Expand Up @@ -235,10 +239,11 @@ would accept a context object and return a `Version` object:

The context object passed to closure contains the following:

- *currentVersion* - current `Version` object that should be used to
calculate next version ([Version
API](https://github.com/zafarkhaja/jsemver/blob/1f4996ea3dab06193c378fd66fd4f8fdc8334cc6/src/main/java/com/github/zafarkhaja/semver/Version.java))
- *position* - widely used position object, for more see [ScmPosition](https://github.com/allegro/axion-release-plugin/blob/main/src/main/java/pl/allegro/tech/build/axion/release/domain/scm/ScmPosition.java)
- *currentVersion* - current `Version` object that should be used to
calculate next version ([Version
API](https://github.com/zafarkhaja/jsemver/blob/1f4996ea3dab06193c378fd66fd4f8fdc8334cc6/src/main/java/com/github/zafarkhaja/semver/Version.java))
- *position* - widely used position object, for more
see [ScmPosition](https://github.com/allegro/axion-release-plugin/blob/main/src/main/java/pl/allegro/tech/build/axion/release/domain/scm/ScmPosition.java)

You can also specify different incrementers per branch. They can be
either closure, name of predefined incrementer or name and list of
Expand Down Expand Up @@ -361,8 +366,10 @@ Custom version creators can be implemented by creating closure:

{version, position -> ...}

- version - string version resolved by previous steps
- position - [ScmPosition](https://github.com/allegro/axion-release-plugin/blob/main/src/main/java/pl/allegro/tech/build/axion/release/domain/scm/ScmPosition.java) object
- version - string version resolved by previous steps
-
position - [ScmPosition](https://github.com/allegro/axion-release-plugin/blob/main/src/main/java/pl/allegro/tech/build/axion/release/domain/scm/ScmPosition.java)
object

### Snapshot

Expand All @@ -378,9 +385,10 @@ Snapshot creator can be implemented by creating closure:

{version, position -> ...}

- version - string version resolved by previous steps
- position - [ScmPosition](https://github.com/allegro/axion-release-plugin/blob/main/src/main/java/pl/allegro/tech/build/axion/release/domain/scm/ScmPosition.java) object

- version - string version resolved by previous steps
-
position - [ScmPosition](https://github.com/allegro/axion-release-plugin/blob/main/src/main/java/pl/allegro/tech/build/axion/release/domain/scm/ScmPosition.java)
object

## Sanitization

Expand Down
Loading

0 comments on commit 67cb348

Please sign in to comment.