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 :
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 }}"
@@ -75,28 +70,10 @@ jobs:
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 the full history so we can push the version-bump commit back
75+ # to main (tag checkouts are detached HEAD by default).
76+ fetch-depth : 0
10077
10178 # ── Java + Maven setup ------------------------------------------------
10279 - name : Set up JDK ${{ env.JAVA_VERSION }}
11188 server-password : MAVEN_PASSWORD
11289
11390 # ── Version bump ------------------------------------------------------
114- - name : Update project version to match ZenBPM release
91+ - name : Update project version to match tag
11592 run : |
11693 mvn ${MAVEN_CLI_OPTS} \
11794 versions:set \
@@ -123,9 +100,10 @@ jobs:
123100 run : |
124101 git config user.name "github-actions[bot]"
125102 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
103+ git add "**/pom.xml"
104+ git commit -m "chore: release ${{ steps.version.outputs.version }}" || echo "Nothing to commit"
105+ # Push to main explicitly — tag checkouts leave git in detached HEAD state
106+ git push origin HEAD:refs/heads/main
129107
130108 # ── Build --------------------------------------------------------------
131109 - name : Build & run tests
@@ -165,8 +143,6 @@ jobs:
165143 body : |
166144 ## ZenBPM Java Client ${{ steps.version.outputs.version }}
167145
168- This release corresponds to ZenBPM [${{ steps.version.outputs.version }}](https://github.com/pbinitiative/zenbpm/releases/tag/${{ steps.version.outputs.version }}).
169-
170146 ### Changes
171147 - Updated api.yaml from ZenBPM ${{ steps.version.outputs.version }}
172148 - Generated updated REST client and DTOs
0 commit comments