Skip to content
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
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,39 @@ jobs:
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVENCENTRAL_PASSWORD }}

- name: Prepare next development iteration
env:
DEVELOPMENT_BRANCH: ${{ github.ref_type == 'branch' && github.ref_name || github.event.repository.default_branch }}
run: |
./mvnw -B versions:set -DnextSnapshot=true -DgenerateBackupPoms=false
NEXT_POM="$RUNNER_TEMP/next-development-pom.xml"
cp pom.xml "$NEXT_POM"
git restore -- pom.xml
git fetch origin "refs/heads/$DEVELOPMENT_BRANCH"
if ! git merge-base --is-ancestor HEAD FETCH_HEAD; then
echo "The released commit is not on $DEVELOPMENT_BRANCH; update its development version manually."
exit 1
fi
if ! git diff --quiet HEAD FETCH_HEAD -- pom.xml; then
if git show FETCH_HEAD:pom.xml | cmp -s - "$NEXT_POM"; then
echo "The next development version is already committed."
exit 0
fi
echo "pom.xml changed since the released commit; update its development version manually."
exit 1
fi
git checkout --detach FETCH_HEAD
cp "$NEXT_POM" pom.xml
if git diff --quiet -- pom.xml; then
echo "The next development version is already committed."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -- pom.xml
git commit -m "chore: prepare next development iteration after $JRELEASER_PROJECT_VERSION"
git push origin "HEAD:refs/heads/$DEVELOPMENT_BRANCH"

- name: JReleaser release output
if: always()
uses: actions/upload-artifact@v7
Expand Down
19 changes: 16 additions & 3 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Releases are published to GitHub and Maven Central by JReleaser from a version t
2. Select **Release** in the workflow list.
3. Click **Run workflow**.
4. Leave the branch set to `main` and enter the release version without a leading
`v`, for example `0.0.8`.
`v`, for example `0.1.1`.
5. Click **Run workflow** to start the release.
6. Open the newly created workflow run and wait for the `release` job to complete.
7. Open [github.com/codejive/java-properties/releases](https://github.com/codejive/java-properties/releases)
Expand All @@ -34,14 +34,27 @@ any required environment approval is granted.
2. Create and push an annotated tag whose name is the release version, for example:

```shell
git tag -a v0.0.8 -m "Release v0.0.8"
git push origin v0.0.8
git tag -a v0.1.1 -m "Release v0.1.1"
git push origin v0.1.1
```

3. The `Release` workflow sets the Maven version from the tag, builds the sources and
Javadoc artifacts, and runs JReleaser.
4. Verify the GitHub release and the published component on Maven Central.

After a successful release, the workflow increments the patch version, appends
`-SNAPSHOT`, and commits and pushes `pom.xml` for the next development iteration.
For example, releasing `0.1.1` prepares `0.1.2-SNAPSHOT`. Manual releases update the
selected branch; tag releases update the repository's default branch, which must
contain the tagged commit. The workflow token needs permission to push to that
branch under its branch protection rules.

The workflow preserves newer branch commits and skips an already committed version
bump. If `pom.xml` has otherwise changed since the released commit, or the branch
advances during the push, the preparation step fails without overwriting those
changes. In that case, update and commit the next development version manually;
the published release is already complete.

## Local Configuration Check

This validates the JReleaser configuration without publishing anything:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.codejive</groupId>
<artifactId>java-properties</artifactId>
<version>0.0.9-SNAPSHOT</version>
<version>0.1.1-SNAPSHOT</version>

<name>Java Properties parser</name>
<description>A simple Java Properties parser that retains the exact format of the input file, including any comments</description>
Expand Down
Loading