-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (48 loc) · 2.08 KB
/
release_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
name: Release Pipeline
run-name: "Releasing ${{ github.event.repository.name }} #${{github.run_number}}"
on:
workflow_dispatch
jobs:
initialization:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref_name == 'refs/heads/master'
outputs:
RELEASE_VERSION: ${{steps.splitVersion.outputs._0}}
env:
SNAPSHOTVERSION: ""
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: Verify Is SNAPSHOT Version
if: ${{ !contains(env.POM_VERSION, '-SNAPSHOT')}}
run: |
echo "ERROR: Version is set to incompatible version ${{env.POM_VERSION}}. Only SNAPSHOT development versions can be converted to a release version."
exit 1
- name: Split version code
uses: xom9ikk/split@v1
id: splitVersion
with:
string: ${{env.POM_VERSION}}
separator: -SNAPSHOT
limit: -1
- name: Release Version Env
run: echo "SNAPSHOT=${{steps.splitVersion.outputs._0}}" >> $GITHUB_ENV
- name: Increment Snapshot Version
id: newSnapshotVersion
run: |
echo ${{env.SNAPSHOTVERSION}}
echo "SnapshotVersion=$((${{env.SNAPSHOTVERSION}} + 0.1.0))" >> $GITHUB_OUTPUT
- name: Print Versions
run: |
echo " Snapshot Version -- ${{steps.newSnapshotVersion.outputs.SnapshotVersion}}"
echo " Release Version -- ${{steps.splitVersion.outputs._0}}"