@@ -44,15 +44,34 @@ jobs:
4444 export WORKFLOW_VERSION="${{ github.event.client_payload.version }}"
4545 envsubst '${WORKFLOW_VERSION}' < README.md.tmpl > README.md
4646
47- - name : Bump extension version
47+ - name : Compute plugin version
48+ id : version
4849 run : |
4950 WORKFLOW_VERSION="${{ github.event.client_payload.version }}"
50- EXT_VERSION="${WORKFLOW_VERSION#v}"
51+ VERSION="${WORKFLOW_VERSION#v}"
52+ MAJOR=$(echo "$VERSION" | cut -d. -f1)
53+ MINOR=$(echo "$VERSION" | cut -d. -f2)
54+ PATCH=$(echo "$VERSION" | cut -d. -f3)
55+ BASE=$((PATCH * 100))
56+ CURRENT_VERSION=$(node -p "require('./package.json').version")
57+ CURRENT_PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3)
58+ if [ "$CURRENT_PATCH" -ge "$BASE" ] && [ "$CURRENT_PATCH" -lt "$((BASE + 100))" ]; then
59+ PLUGIN_PATCH=$((CURRENT_PATCH + 1))
60+ else
61+ PLUGIN_PATCH=$BASE
62+ fi
63+ PLUGIN_VERSION="${MAJOR}.${MINOR}.${PLUGIN_PATCH}"
64+ echo "PLUGIN_VERSION=${PLUGIN_VERSION}" >> "$GITHUB_OUTPUT"
65+ echo "Engine ${WORKFLOW_VERSION} → plugin v${PLUGIN_VERSION}"
66+
67+ - name : Bump extension version
68+ run : |
69+ PLUGIN_VERSION="${{ steps.version.outputs.PLUGIN_VERSION }}"
5170 CURRENT_VERSION=$(node -p "require('./package.json').version")
52- if [ "${CURRENT_VERSION}" = "${EXT_VERSION }" ]; then
53- echo "Version already at ${EXT_VERSION }, skipping"
71+ if [ "${CURRENT_VERSION}" = "${PLUGIN_VERSION }" ]; then
72+ echo "Version already at ${PLUGIN_VERSION }, skipping"
5473 else
55- npm version "${EXT_VERSION }" --no-git-tag-version
74+ npm version "${PLUGIN_VERSION }" --no-git-tag-version
5675 fi
5776
5877 - name : Install and build
@@ -64,15 +83,16 @@ jobs:
6483 - name : Commit and tag
6584 run : |
6685 WORKFLOW_VERSION="${{ github.event.client_payload.version }}"
86+ PLUGIN_VERSION="v${{ steps.version.outputs.PLUGIN_VERSION }}"
6787 git config user.name "github-actions[bot]"
6888 git config user.email "github-actions[bot]@users.noreply.github.com"
6989 git add -A
7090 git diff --cached --quiet && echo "No changes" && exit 0
71- git commit -m "chore: sync schema and version to workflow ${WORKFLOW_VERSION}"
91+ git commit -m "chore: sync schema and version to workflow ${WORKFLOW_VERSION} (plugin ${PLUGIN_VERSION}) "
7292 git push
73- if git rev-parse "${WORKFLOW_VERSION }" >/dev/null 2>&1; then
74- echo "Tag ${WORKFLOW_VERSION } already exists, skipping"
93+ if git rev-parse "${PLUGIN_VERSION }" >/dev/null 2>&1; then
94+ echo "Tag ${PLUGIN_VERSION } already exists, skipping"
7595 else
76- git tag "${WORKFLOW_VERSION }"
77- git push origin "${WORKFLOW_VERSION }"
96+ git tag "${PLUGIN_VERSION }"
97+ git push origin "${PLUGIN_VERSION }"
7898 fi
0 commit comments