Skip to content

ci: automatic release process #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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