-
Notifications
You must be signed in to change notification settings - Fork 3
75 lines (71 loc) · 2.67 KB
/
workflow-bump-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
name: Bump version
on:
workflow_call:
inputs:
new-maven-version:
description: 'Connect new maven version'
type: string
required: false
workflow_dispatch:
inputs:
new-maven-version:
description: 'Connect new maven version'
type: string
required: false
jobs:
bump-versions:
name: Bumps versions
runs-on: ubuntu-latest
steps:
- name: PREP / Checkout code
uses: actions/checkout@v4
- name: PREP / Setup git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Miranum Github Bot"
- name: PREP / Prepare mvnw
run: chmod +x ./mvnw
- name: PREP / Install Java and Maven
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
- name: BUMP VERSION / Raise mvn version
if: inputs.new-maven-version != ''
run: |
sed -i "s/<revision>.*<\/revision>/<revision>${{ inputs.connect-new-maven-version }}-SNAPSHOT<\/revision>/" connect/pom.xml
- name: BUMP VERSION / Raise mvn version
if: inputs.new-maven-version == ''
run: |
# increment minor version
sed -i "s/<revision>.*<\/revision>/<revision>$(./mvnw -f connect help:evaluate -Dexpression=project.version -q -DforceStdout | awk -F'.' '{print $1"."$2+1".0-SNAPSHOT"}' | sed s/[.]$//)<\/revision>/" connect/pom.xml
- name: GIT / Git commit
run: |
git add .
git commit -m "chore: mvn auto version bump connect to $(./mvnw -f connect help:evaluate -Dexpression=project.version -q -DforceStdout)"
- name: GIT / Push changes to new branch
run: |
git checkout -b ${{ github.ref_name }}-version-bump
git push --force origin ${{ github.ref_name }}-version-bump
- name: GIT / Create pull request
uses: actions/github-script@v7
with:
script: |
const { repo, owner } = context.repo;
const pullResult = await github.rest.pulls.create({
title: 'chore: bump release version ${{ github.ref_name }}',
owner,
repo,
head: '${{ github.ref_name }}-version-bump',
base: '${{ github.ref_name }}',
body: [
'This PR is auto-generated'
].join('\n')
});
await github.rest.issues.addAssignees({
owner,
repo,
issue_number: pullResult.data.number,
assignees: ['${{ github.actor }}'],
});
console.log(`Pull Request created: ${pullResult.data.html_url}`);