-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (68 loc) · 2.63 KB
/
release_version_poc.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Increment Release Version Pipeline
run-name: "Incrementing Release Version -- ${{github.event.inputs.action}}"
on:
workflow_dispatch:
inputs:
action:
type: choice
description: Version To Increment
options:
- Major
- Minor
- Patch
required: true
env:
INCREMENTING_VERSION: ${{github.event.inputs.action}}
jobs:
get_version:
runs-on: ubuntu-latest
name: Get Version
outputs:
_MAJOR: ${{steps.splitVersionMinor.outputs._0}}
_MINOR: ${{steps.splitVersionMinor.outputs._1}}
_PATCH: 10 ##${{steps.splitVersionMinor.outputs._2}}
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Downloading Java
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Get Current Version
run: |
echo "POM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Print Version
run: echo ${{env.POM_VERSION}}
- name: Split version code
uses: xom9ikk/split@v1
id: splitVersion
with:
string: ${{env.POM_VERSION}}
separator: -SNAPSHOT
limit: -1
- name: Split version code - Minor
uses: xom9ikk/split@v1
id: splitVersionMinor
with:
string: ${{steps.splitVersion.outputs._0}}
separator: .
limit: -1
increment_version:
runs-on: ubuntu-latest
needs: get_version
name: "Increment ${{github.event.inputs.action}} Version"
steps:
- name: Set Env - Major
shell: bash
run: |
VERSION_PICKED=${{env.INCREMENTING_VERSION}}
if [[ "$VERSION_PICKED" == "Major" ]]; then
echo "VERSION_NUMBER=${{needs.get_version.outputs._MAJOR}}" >> $GITHUB_ENV
elif [[ "$VERSION_PICKED" == "Minor" ]]; then
echo "VERSION_NUMBER=${{needs.get_version.outputs._MINOR}}" >> $GITHUB_ENV
else
echo "VERSION_NUMBER=${{needs.get_version.outputs._PATCH}}" >> $GITHUB_ENV
fi
- name: Print Version
run: echo ${{env.INCREMENTING_VERSION}} -- ${{env.VERSION_NUMBER}}