-
Notifications
You must be signed in to change notification settings - Fork 2
38 lines (37 loc) · 1.69 KB
/
branch.yml
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
---
name: 'create release branch'
run-name: Creating release branch by ${{ github.actor }}
on:
workflow_dispatch:
jobs:
branch:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
env:
MAVEN_OPTS: '-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
steps:
- uses: actions/checkout@v4
- uses: oleksiyrudenko/gha-git-credentials@v2.1.2
with:
global: true
name: 'github $GITHUB_ACTOR'
email: 'digitaal-techniek@vpro.nl'
token: '${{ secrets.GITHUB_TOKEN }}'
- name: Release branch with Maven
# We are in a kind of hybrid situation
# For main we use 'CI friendly' versioning (using 'revision' and 'changelist' properties).
# For release branches this is overridden by the release:branch plugin
run: |
VERSION=`mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout`
RELEASE_VERSION=`echo $VERSION | sed -r 's/-SNAPSHOT/.0-SNAPSHOT/'`
REVISION=`mvn -B help:evaluate -Dexpression=revision -q -DforceStdout`
DEVELOPMENT_REVISION=`echo $REVISION | gawk 'match($1, /([0-9]+)\.([0-9]+)/, a) {print a[1]"."(a[2]+1)}'`
BRANCH=REL-$VERSION
git checkout -b $BRANCH
mvn -DnewVersion=$RELEASE_VERSION versions:set
git commit -am "Updated version to ${RELEASE_VERSION} for release branch"
git push origin $BRANCH
git checkout main
mvn -B versions:set-property -Dproperty=revision -DnewVersion=$DEVELOPMENT_REVISION
git commit -am "Updated revision to ${DEVELOPMENT_REVISION} for next development iteration"
git push origin main