Skip to content

Commit

Permalink
ci: automatic release process (#30)
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa authored May 30, 2024
1 parent f6986a3 commit 89a91da
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 18 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,17 @@ build:
.PHONY: test
test:
./mvnw verify

.PHONY: release
release:
@if [ -z "$(V)" ]; then echo "V is not set"; exit 1; fi
@if [ -z "$(VS)" ]; then echo "VS is not set"; exit 1; fi
@mvn versions:set -DnewVersion=$(V) -DgenerateBackupPoms=false
@git add .
@git commit -m "[RELEASE] Updated project version to v$(V)"
@git tag v$(V)
@git push origin v$(V)
@mvn versions:set -DnewVersion=$(VS)-SNAPSHOT -DgenerateBackupPoms=false
@git add .
@git commit -m "[RELEASE] v$(V) released, prepare for next development iteration"
@git push origin main
47 changes: 30 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,38 @@ mvn -Pit-debug verify
```
Then, configure your IDE to perform a remote debug connection to port `8000`.

## Release process
### Release Process

The project version should always point to the next release version.
#### Release to Maven Central

To release a new version, first tag the release with the current `pom.xml` version e.g. `v0.0.5`.
To release a new version automatically:

```shell
git tag v0.0.5
git push origin v0.0.5
```

Once we perform a release we need to set the next release version in the `pom.xml` file.

```shell
mvn versions:set -DnewVersion=0.0.6 -DgenerateBackupPoms=false
```

Then, commit the changes with the following message:

```shell
git commit -m "[RELEASE] v0.0.5 released, prepare for next development iteration"
make release V=X.Y.Z VS=X.Y
```
- `V`: New version to release.
- `VS`: New SNAPSHOT version for Maven.

To release a new version manually:

1. Update the version in the `pom.xml` file.
```shell
mvn versions:set -DnewVersion=X.Y.Z -DgenerateBackupPoms=false
```
2. Commit and tag the release with the `pom.xml` version.
```shell
git add .
git commit -m "[RELEASE] vX.Y.Z released"
git tag vX.Y.Z
git push origin vX.Y.Z
```
3. Update the version in the `pom.xml` file to the next snapshot version.
```shell
mvn versions:set -DnewVersion=X.Y-SNAPSHOT -DgenerateBackupPoms=false
```
4. Commit the changes with the following message:
```shell
git add .
git commit -m "[RELEASE] v0.0.5 released, prepare for next development iteration"
git push origin master
```
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.marcnuri.plugins</groupId>
<artifactId>gradle-api-maven-plugin</artifactId>
<version>0.0.6</version>
<version>0.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Gradle API Maven Plugin</name>
<description>
Expand Down

0 comments on commit 89a91da

Please sign in to comment.