11# =============================================================================
22# Release pipeline for zenbpm-java-client
33#
4- # Automatically triggered when ZenBPM (pbinitiative/zenbpm) publishes a new
5- # release. Copies the latest api.yaml from ZenBPM, bumps the project version
6- # to match, builds, and deploys to the configured Maven repository.
4+ # Triggered when a version tag (e.g. v1.2.3) is pushed to this repository.
5+ # The expected flow is:
6+ # 1. Another pipeline (e.g. pbinitiative/zenbpm) updates api.yaml in this
7+ # repo and commits it to main.
8+ # 2. That same pipeline pushes a matching version tag to this repo.
9+ # 3. This workflow fires, bumps pom.xml to match the tag, builds, and
10+ # deploys to the configured Maven repository.
711#
812# Requirements (set up in GitHub repo Settings → Secrets and variables → Actions):
9- # Secret: ZENBPM_READ_TOKEN
10- # A GitHub Personal Access Token (classic or fine-grained) with at least
11- # "Contents: read" access to pbinitiative/zenbpm. Used to check out the
12- # matching tag from the upstream ZenBPM repo.
13- #
14- # To trigger from ZenBPM's release workflow, add a step like:
15- # - name: Trigger Java client release
16- # uses: peter-evans/repository-dispatch@v3
17- # with:
18- # token: ${{ secrets.ZENBPM_JAVA_CLIENT_ACCESS_TOKEN }}
19- # repository: pbinitiative/zenbpm-java-client
20- # event-type: release-upstream
21- # client-payload: '{"version": "${{ github.ref_name }}"}'
13+ # No extra secrets are required beyond the default GITHUB_TOKEN.
14+ # If you also deploy to Maven Central, add:
15+ # MAVEN_CENTRAL_USERNAME, MAVEN_CENTRAL_PASSWORD, GPG_PRIVATE_KEY, GPG_PASSPHRASE
2216# =============================================================================
2317
2418name : Release to Maven Repository
2519
2620on :
27- # 1) Automated trigger from ZenBPM's own release workflow
28- repository_dispatch :
29- types : [release-upstream]
21+ # Triggered by pushing a version tag, e.g.: git tag v1.2.3 && git push origin v1.2.3
22+ push :
23+ tags :
24+ - ' v*'
3025
31- # 2) Manual trigger for testing or ad-hoc releases
26+ # Manual trigger for testing or ad-hoc releases
3227 workflow_dispatch :
3328 inputs :
3429 version :
3732 type : string
3833
3934permissions :
40- contents : write # create GitHub Release + tag, push version bump commit
35+ contents : write # create GitHub Release
4136 packages : write # deploy to GitHub Packages
4237
4338env :
5449 id : version
5550 run : |
5651 case "${{ github.event_name }}" in
57- repository_dispatch )
58- VERSION="${{ github.event.client_payload.version }}"
52+ push )
53+ VERSION="${{ github.ref_name }}"
5954 ;;
6055 workflow_dispatch)
6156 VERSION="${{ github.event.inputs.version }}"
7570 # ── Checkout sources --------------------------------------------------
7671 - name : Checkout zenbpm-java-client
7772 uses : actions/checkout@v4
78-
79- - name : Checkout ZenBPM at matching tag
80- uses : actions/checkout@v4
8173 with :
82- repository : pbinitiative/zenbpm
83- ref : ${{ steps.version.outputs.version }}
84- token : ${{ secrets.ZENBPM_READ_TOKEN }}
85- path : upstream/zenbpm
86-
87- # ── Copy api.yaml -----------------------------------------------------
88- - name : Copy api.yaml from ZenBPM
89- run : |
90- SRC="upstream/zenbpm/openapi/api.yaml"
91- DST="zenbpm-client-core/src/main/resources/openapi/api.yaml"
92-
93- if [ ! -f "$SRC" ]; then
94- echo "ERROR: api.yaml not found at ${SRC}"
95- exit 1
96- fi
97-
98- cp -v "$SRC" "$DST"
99- echo "Copied api.yaml ($(wc -l < "$DST") lines)"
74+ fetch-depth : 1
10075
10176 # ── Java + Maven setup ------------------------------------------------
10277 - name : Set up JDK ${{ env.JAVA_VERSION }}
@@ -110,23 +85,17 @@ jobs:
11085 server-username : MAVEN_USERNAME
11186 server-password : MAVEN_PASSWORD
11287
113- # ── Version bump ------------------------------------------------------
114- - name : Update project version to match ZenBPM release
88+ # ── Version bump (transient — not committed back) --------------------
89+ # The tag is the source of truth for the version. We apply it in-place
90+ # so that the built artifacts carry the right version, but we do not
91+ # push any changes back to the repo.
92+ - name : Set project version to match tag
11593 run : |
11694 mvn ${MAVEN_CLI_OPTS} \
11795 versions:set \
11896 -DnewVersion="${{ steps.version.outputs.version_no_v }}" \
11997 -DgenerateBackupPoms=false
12098
121- # ── Commit version bump -----------------------------------------------
122- - name : Commit and push version bump
123- run : |
124- git config user.name "github-actions[bot]"
125- git config user.email "github-actions[bot]@users.noreply.github.com"
126- git add "**/pom.xml" zenbpm-client-core/src/main/resources/openapi/api.yaml
127- git commit -m "chore: release ${{ steps.version.outputs.version }}"
128- git push
129-
13099 # ── Build --------------------------------------------------------------
131100 - name : Build & run tests
132101 run : mvn ${MAVEN_CLI_OPTS} clean verify
@@ -165,8 +134,6 @@ jobs:
165134 body : |
166135 ## ZenBPM Java Client ${{ steps.version.outputs.version }}
167136
168- This release corresponds to ZenBPM [${{ steps.version.outputs.version }}](https://github.com/pbinitiative/zenbpm/releases/tag/${{ steps.version.outputs.version }}).
169-
170137 ### Changes
171138 - Updated api.yaml from ZenBPM ${{ steps.version.outputs.version }}
172139 - Generated updated REST client and DTOs
0 commit comments