Skip to content

Commit

Permalink
Update release.yml action
Browse files Browse the repository at this point in the history
  • Loading branch information
barreiro authored and johnaohara committed Nov 7, 2024
1 parent 9ba5fc2 commit 1264394
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Create new branch
env:
ENVIRONMENT: CI
runs-on: ubuntu-latest
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
Expand All @@ -20,32 +20,32 @@ jobs:
distribution: 'adopt'
java-version: 17
- name: install yq
run: wget https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O ~/yq && chmod +x ~/yq
run: wget https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O ~/yq && chmod +x ~/yq
- name: Maven Version
run: mvn --version
# Retrieve current version from the root pom
- name: Get version
run: |
PROJECT_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -q -DforceStdout)
echo PROJECT_VERSION=${PROJECT_VERSION} >> $GITHUB_ENV
echo CUR_VERSION=$(echo ${PROJECT_VERSION} | awk -F'.' '{print $1"."$2+0"."$3}' | sed s/[.]$//) >> $GITHUB_ENV
echo NEXT_VERSION=$(echo ${PROJECT_VERSION} | awk -F'.' '{print $1"."$2+1}' | sed s/[.]$//) >> $GITHUB_ENV
echo CUR_VERSION=$(echo ${PROJECT_VERSION} | awk -F'.' '{print $1"."$2+0"."$3}' | sed s/[.]$//) >> $GITHUB_ENV
echo NEXT_VERSION=$(echo ${PROJECT_VERSION} | awk -F'.' '{print $1"."$2+1}' | sed s/[.]$//) >> $GITHUB_ENV
- name: Create branch ${{ env.CUR_VERSION }}
run: git branch ${{ env.CUR_VERSION }} master
- name: Bump next version ${{ env.NEXT_VERSION }}-SNAPSHOT
run: mvn versions:set -DnewVersion=${{ env.NEXT_VERSION }}-SNAPSHOT
run: mvn -B -ntp versions:set -DnewVersion=${{ env.NEXT_VERSION }}-SNAPSHOT
- name: Set major version ${{ env.NEXT_VERSION }}
run: mvn versions:set-property -Dproperty=major-version -DnewVersion=${{ env.NEXT_VERSION }}
run: mvn -B -ntp versions:set-property -Dproperty=major-version -DnewVersion=${{ env.NEXT_VERSION }}
- name: Update main workflow
run: ~/yq -i e '.on.push.branches |= [ "master", '${{ env.CUR_VERSION }}' ]' .github/workflows/main.yml
run: ~/yq -i e '.on.push.branches |= [ "master", '${{ env.CUR_VERSION }}' ]' .github/workflows/main.yml
- name: Update release branch
run: ~/yq -i e '.env.RELEASE_BRANCH |= '${{ env.CUR_VERSION }} .github/workflows/release.yml
run: ~/yq -i e '.env.RELEASE_BRANCH |= '${{ env.NEXT_VERSION }} .github/workflows/release.yml
- name: Update Notify clients workflow
run: ~/yq -i e '.on.push.branches |= [ "master", '${{ env.CUR_VERSION }}' ]' .github/workflows/notify-clients.yaml
run: ~/yq -i e '.on.push.branches |= [ "master", '${{ env.CUR_VERSION }}' ]' .github/workflows/notify-clients.yaml
- name: Update backport workflow
run: ~/yq -i e '.jobs.backporting.steps[1].with.target-branch |= '${{ env.CUR_VERSION }} .github/workflows/backport.yml
run: ~/yq -i e '.jobs.backporting.steps[1].with.target-branch |= '${{ env.CUR_VERSION }} .github/workflows/backport.yml
- name: build new openapi.yaml
run: mvn clean package -DskipTests -DskipITs -pl horreum-api
run: mvn -B -ntp clean package -DskipTests -DskipITs -pl horreum-api
- name: Configure git
run: |
git config --global user.name "rh-appservices-perf"
Expand All @@ -56,7 +56,7 @@ jobs:
- name: Update cur branch
run: |
git checkout ${{ env.CUR_VERSION }}
mvn versions:set -DnewVersion=${{ env.CUR_VERSION }}.0-SNAPSHOT
mvn -B -ntp versions:set -DnewVersion=${{ env.CUR_VERSION }}.0-SNAPSHOT
- name: Commit current release branch
run: |
git commit -a -m "Branching ${{ env.CUR_VERSION }}"
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ name: Perform Release
on:
workflow_dispatch:
env:
RELEASE_BRANCH: 0.15
RELEASE_BRANCH: 0.16
jobs:
build:
name: Perform release
if: github.ref != 'refs/heads/master'
env:
ENVIRONMENT: CI
runs-on: ubuntu-latest
Expand Down Expand Up @@ -48,11 +49,11 @@ jobs:
- name: Release to Maven
run: |
PROJECT_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -q -DforceStdout)
CUR_VER=$(echo ${PROJECT_VERSION} | awk -F '-' '{ print $1}' | awk -F'.' '{print $1+0"."$2+0"."$3+0}' | sed s/[.]$//)
NEXT_VER=$(echo ${PROJECT_VERSION} | awk -F '-' '{ print $1}' | awk -F'.' '{print $1+0"."$2+0"."$3+1"-SNAPSHOT"}' | sed s/[.]$//)
CUR_VER=$(echo ${PROJECT_VERSION} | awk -F '-' '{ print $1}' | awk -F'.' '{print $1+0"."$2+0"."$3+0}' | sed s/[.]$//)
NEXT_VER=$(echo ${PROJECT_VERSION} | awk -F '-' '{ print $1}' | awk -F'.' '{print $1+0"."$2+0"."$3+1"-SNAPSHOT"}' | sed s/[.]$//)
echo "CUR_VER=$CUR_VER" >> "$GITHUB_ENV"
mvn -DskipTests clean javadoc:javadoc install
mvn --batch-mode -Darguments=-DskipTests -Dtag=$CUR_VER release:prepare release:perform -DreleaseVersion=$CUR_VER -DdevelopmentVersion=$NEXT_VER -Dresume=false
mvn -B -ntp -DskipTests clean javadoc:javadoc install
mvn -B -ntp -Darguments=-DskipTests -Dtag=$CUR_VER release:prepare release:perform -DreleaseVersion=$CUR_VER -DdevelopmentVersion=$NEXT_VER -Dresume=false
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
Expand Down

0 comments on commit 1264394

Please sign in to comment.