Skip to content

Commit d82508a

Browse files
committed
Perform release action on current branch
1 parent 9ba5fc2 commit d82508a

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

.github/workflows/branch.yml

+12-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
name: Create new branch
99
env:
1010
ENVIRONMENT: CI
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-latest
1212

1313
steps:
1414
- uses: actions/checkout@v4
@@ -20,32 +20,32 @@ jobs:
2020
distribution: 'adopt'
2121
java-version: 17
2222
- name: install yq
23-
run: wget https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O ~/yq && chmod +x ~/yq
23+
run: wget https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O ~/yq && chmod +x ~/yq
2424
- name: Maven Version
2525
run: mvn --version
2626
# Retrieve current version from the root pom
2727
- name: Get version
2828
run: |
2929
PROJECT_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -q -DforceStdout)
3030
echo PROJECT_VERSION=${PROJECT_VERSION} >> $GITHUB_ENV
31-
echo CUR_VERSION=$(echo ${PROJECT_VERSION} | awk -F'.' '{print $1"."$2+0"."$3}' | sed s/[.]$//) >> $GITHUB_ENV
32-
echo NEXT_VERSION=$(echo ${PROJECT_VERSION} | awk -F'.' '{print $1"."$2+1}' | sed s/[.]$//) >> $GITHUB_ENV
31+
echo CUR_VERSION=$(echo ${PROJECT_VERSION} | awk -F'.' '{print $1"."$2+0"."$3}' | sed s/[.]$//) >> $GITHUB_ENV
32+
echo NEXT_VERSION=$(echo ${PROJECT_VERSION} | awk -F'.' '{print $1"."$2+1}' | sed s/[.]$//) >> $GITHUB_ENV
3333
- name: Create branch ${{ env.CUR_VERSION }}
3434
run: git branch ${{ env.CUR_VERSION }} master
3535
- name: Bump next version ${{ env.NEXT_VERSION }}-SNAPSHOT
36-
run: mvn versions:set -DnewVersion=${{ env.NEXT_VERSION }}-SNAPSHOT
36+
run: mvn -B -ntp versions:set -DnewVersion=${{ env.NEXT_VERSION }}-SNAPSHOT
3737
- name: Set major version ${{ env.NEXT_VERSION }}
38-
run: mvn versions:set-property -Dproperty=major-version -DnewVersion=${{ env.NEXT_VERSION }}
38+
run: mvn -B -ntp versions:set-property -Dproperty=major-version -DnewVersion=${{ env.NEXT_VERSION }}
3939
- name: Update main workflow
40-
run: ~/yq -i e '.on.push.branches |= [ "master", '${{ env.CUR_VERSION }}' ]' .github/workflows/main.yml
40+
run: ~/yq -i e '.on.push.branches |= [ "master", '${{ env.CUR_VERSION }}' ]' .github/workflows/main.yml
4141
- name: Update release branch
42-
run: ~/yq -i e '.env.RELEASE_BRANCH |= '${{ env.CUR_VERSION }} .github/workflows/release.yml
42+
run: ~/yq -i e '.env.RELEASE_BRANCH |= '${{ env.NEXT_VERSION }} .github/workflows/release.yml
4343
- name: Update Notify clients workflow
44-
run: ~/yq -i e '.on.push.branches |= [ "master", '${{ env.CUR_VERSION }}' ]' .github/workflows/notify-clients.yaml
44+
run: ~/yq -i e '.on.push.branches |= [ "master", '${{ env.CUR_VERSION }}' ]' .github/workflows/notify-clients.yaml
4545
- name: Update backport workflow
46-
run: ~/yq -i e '.jobs.backporting.steps[1].with.target-branch |= '${{ env.CUR_VERSION }} .github/workflows/backport.yml
46+
run: ~/yq -i e '.jobs.backporting.steps[1].with.target-branch |= '${{ env.CUR_VERSION }} .github/workflows/backport.yml
4747
- name: build new openapi.yaml
48-
run: mvn clean package -DskipTests -DskipITs -pl horreum-api
48+
run: mvn -B -ntp clean package -DskipTests -DskipITs -pl horreum-api
4949
- name: Configure git
5050
run: |
5151
git config --global user.name "rh-appservices-perf"
@@ -56,7 +56,7 @@ jobs:
5656
- name: Update cur branch
5757
run: |
5858
git checkout ${{ env.CUR_VERSION }}
59-
mvn versions:set -DnewVersion=${{ env.CUR_VERSION }}.0-SNAPSHOT
59+
mvn -B -ntp versions:set -DnewVersion=${{ env.CUR_VERSION }}.0-SNAPSHOT
6060
- name: Commit current release branch
6161
run: |
6262
git commit -a -m "Branching ${{ env.CUR_VERSION }}"

.github/workflows/release.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ name: Perform Release
33
on:
44
workflow_dispatch:
55
env:
6-
RELEASE_BRANCH: 0.15
6+
RELEASE_BRANCH: 0.16
77
jobs:
88
build:
99
name: Perform release
10+
if: github.ref != 'refs/heads/master'
1011
env:
1112
ENVIRONMENT: CI
1213
runs-on: ubuntu-latest
@@ -48,11 +49,11 @@ jobs:
4849
- name: Release to Maven
4950
run: |
5051
PROJECT_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -q -DforceStdout)
51-
CUR_VER=$(echo ${PROJECT_VERSION} | awk -F '-' '{ print $1}' | awk -F'.' '{print $1+0"."$2+0"."$3+0}' | sed s/[.]$//)
52-
NEXT_VER=$(echo ${PROJECT_VERSION} | awk -F '-' '{ print $1}' | awk -F'.' '{print $1+0"."$2+0"."$3+1"-SNAPSHOT"}' | sed s/[.]$//)
52+
CUR_VER=$(echo ${PROJECT_VERSION} | awk -F '-' '{ print $1}' | awk -F'.' '{print $1+0"."$2+0"."$3+0}' | sed s/[.]$//)
53+
NEXT_VER=$(echo ${PROJECT_VERSION} | awk -F '-' '{ print $1}' | awk -F'.' '{print $1+0"."$2+0"."$3+1"-SNAPSHOT"}' | sed s/[.]$//)
5354
echo "CUR_VER=$CUR_VER" >> "$GITHUB_ENV"
54-
mvn -DskipTests clean javadoc:javadoc install
55-
mvn --batch-mode -Darguments=-DskipTests -Dtag=$CUR_VER release:prepare release:perform -DreleaseVersion=$CUR_VER -DdevelopmentVersion=$NEXT_VER -Dresume=false
55+
mvn -B -ntp -DskipTests clean javadoc:javadoc install
56+
mvn -B -ntp -Darguments=-DskipTests -Dtag=$CUR_VER release:prepare release:perform -DreleaseVersion=$CUR_VER -DdevelopmentVersion=$NEXT_VER -Dresume=false
5657
env:
5758
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
5859
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

0 commit comments

Comments
 (0)