-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (81 loc) · 2.58 KB
/
set-version.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
79
80
81
82
name: Sets version on project
on:
workflow_call:
inputs:
java-version:
description: "JDK Version"
type: string
required: true
version:
description: "Version to set"
type: string
required: true
commit:
description: "Commit"
type: boolean
default: false
commit_message:
description: "Commit message"
type: string
create_tag:
description: "Create tag"
type: boolean
default: false
env:
CI_COMMIT_AUTHOR: Dac-Cloud-Bot
CI_COMMIT_AUTHOR_EMAIL: [email protected]
CI_COMMIT_MESSAGE: "[CI] ${{ inputs.commit_message }}"
jobs:
set-version:
if: inputs.commit == false
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
cache: maven
- name: Set next release version
run: mvn versions:set -DnewVersion=${{ inputs.version }} -DprocessAllModules
set-version-tag-and-commit:
if: inputs.commit && inputs.create_tag
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
cache: maven
- name: GIT commit and push all changed files
run: |
git pull
mvn versions:set -DnewVersion=${{ inputs.version }} -DprocessAllModules
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_AUTHOR_EMAIL }}"
git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
git tag -a v${{ inputs.version }} -m "Version ${{ inputs.version }}"
git push --tags
set-version-and-commit:
if: inputs.commit && inputs.create_tag == false
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
cache: maven
- name: GIT commit and push all changed files
run: |
git pull
mvn versions:set -DnewVersion=${{ inputs.version }} -DprocessAllModules
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_AUTHOR_EMAIL }}"
git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
git push