Skip to content

Commit 5bfed35

Browse files
committed
Improve digma version bump action
1 parent 1d1ec09 commit 5bfed35

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

.github/workflows/digma-bump.yml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@ name: Bump Digma Jaeger UI version and push git tag
33
on:
44
workflow_dispatch:
55
inputs:
6-
version:
7-
description: 'Version to set (e.g., 1.2.3)'
6+
version_type:
7+
description: 'Type of version bump'
88
required: true
9+
type: choice
10+
options:
11+
- major
12+
- minor
13+
- patch
14+
- premajor
15+
- preminor
16+
- prepatch
17+
- prerelease
918

1019
jobs:
1120
bump:
@@ -24,14 +33,29 @@ jobs:
2433
VERSION=$(jq -r '.version' ./packages/jaeger-ui/package.json)
2534
echo "VERSION=$VERSION" >> $GITHUB_ENV
2635
36+
- name: Get current digma-jaeger-ui version
37+
id: get-version
38+
run: |
39+
CURRENT_DIGMA_JAEGER_UI_VERSION=$(jq -r '.["digma-jaeger-ui-version"]' ./packages/jaeger-ui/package.json)
40+
echo "CURRENT_DIGMA_JAEGER_UI_VERSION=$CURRENT_DIGMA_JAEGER_UI_VERSION" >> $GITHUB_ENV
41+
42+
- name: Calculate next digma-jaeger-ui version
43+
run: |
44+
if [[ "${{ inputs.version_type }}" == "prerelease" || "${{ inputs.version_type }}" == "premajor" || "${{ inputs.version_type }}" == "preminor" || "${{ inputs.version_type }}" == "prepatch" ]]; then
45+
NEXT_DIGMA_JAEGER_UI_VERSION=$(npx semver $CURRENT_DIGMA_JAEGER_UI_VERSION -i ${{ inputs.version_type }} --preid alpha)
46+
else
47+
NEXT_DIGMA_JAEGER_UI_VERSION=$(npx semver $CURRENT_DIGMA_JAEGER_UI_VERSION -i ${{ inputs.version_type }})
48+
fi
49+
echo "NEXT_DIGMA_JAEGER_UI_VERSION=$NEXT_DIGMA_JAEGER_UI_VERSION" >> $GITHUB_ENV
50+
2751
- name: Update digma-jaeger-ui version
2852
run: |
29-
jq '.["digma-jaeger-ui-version"] = "${{ inputs.version }}"' ./packages/jaeger-ui/package.json > tmp.$$.json && mv tmp.$$.json ./packages/jaeger-ui/package.json
53+
jq '.["digma-jaeger-ui-version"] = "${{ env.NEXT_DIGMA_JAEGER_UI_VERSION }}"' ./packages/jaeger-ui/package.json > tmp.$$.json && mv tmp.$$.json ./packages/jaeger-ui/package.json
3054
3155
- run: |
32-
TAG="v${{ env.VERSION }}-digma.${{ inputs.version }}"
56+
TAG="v${{ env.VERSION }}-digma.${{ env.NEXT_DIGMA_JAEGER_UI_VERSION }}"
3357
git add packages/jaeger-ui/package.json
34-
git commit -m "Bump Digma Jaeger UI version to ${{ inputs.version }} [skip ci]"
58+
git commit -m "Bump Digma Jaeger UI version to ${{ env.NEXT_DIGMA_JAEGER_UI_VERSION }} [skip ci]"
3559
git tag $TAG
3660
git push
3761
git push origin $TAG

0 commit comments

Comments
 (0)