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
22 changes: 16 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ name: Prepare release
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Version to release, such as 1.2.3. Leave empty to release the pom's version without -SNAPSHOT."
required: false
default: ""
developmentVersion:
description: "Default version to use for new local working copy."
description: "Next development version, set on main after the release, such as 1.2.4-SNAPSHOT."
required: true
default: "X.Y.Z-SNAPSHOT"
dryRun:
Expand Down Expand Up @@ -51,16 +55,21 @@ jobs:
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"

# The version is the one release:prepare will tag: the pom's version without
# -SNAPSHOT. git-cliff is told it rather than bumping from the commit types, so
# that the changelog, the Maven tag and the GitHub release always agree.
# The version is the one release:prepare will tag: the releaseVersion input,
# or else the pom's version without -SNAPSHOT. git-cliff is told it rather than
# bumping from the commit types, so that the changelog, the Maven tag and the
# GitHub release always agree.
- name: Determine and check the versions
id: release-version
env:
RELEASE_VERSION: ${{ inputs.releaseVersion }}
DEVELOPMENT_VERSION: ${{ inputs.developmentVersion }}
run: |
version=$(sed -n '0,/<version>/s|.*<version>\([^<]*\)</version>.*|\1|p' pom.xml)
version="${version%-SNAPSHOT}"
version="$RELEASE_VERSION"
if [ -z "$version" ]; then
version=$(sed -n '0,/<version>/s|.*<version>\([^<]*\)</version>.*|\1|p' pom.xml)
version="${version%-SNAPSHOT}"
fi
if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::The release version must look like 1.2.3"
exit 1
Expand Down Expand Up @@ -125,6 +134,7 @@ jobs:
mvn -B release:prepare -DpushChanges=false \
-DpreparationGoals="clean validate" \
-DdryRun=${{ inputs.dryRun }} \
-DreleaseVersion="$EXPECTED_VERSION" \
-DdevelopmentVersion="$DEVELOPMENT_VERSION"

# Get the release version from the release.properties file
Expand Down
7 changes: 4 additions & 3 deletions docs/guide/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ caches, so a native rebuild also includes the updated patches.
## Release workflow

Maintainers start **Prepare release** (`release.yml`) from `main`, providing the
next development version, such as `0.16.0-SNAPSHOT`. Preparation commits the
changelog and version changes and atomically pushes `main` and the release tag.
It then dispatches **Publish release** (`release-publish.yml`) on that tag using
next development version, such as `0.16.0-SNAPSHOT`, and optionally the version
to release, such as `0.15.0`. Without one, the release takes the root pom's
version without `-SNAPSHOT`. Preparation commits the changelog and version
changes and atomically pushes `main` and the release tag. It then dispatches **Publish release** (`release-publish.yml`) on that tag using
`GITHUB_TOKEN` with `actions: write`; no additional token is needed. A push made
with `GITHUB_TOKEN` does not trigger a tag push workflow on its own.

Expand Down
Loading