Skip to content

Commit

Permalink
Feature/work on release pipeline (#494)
Browse files Browse the repository at this point in the history
* start work on release pipeline

* firsts step release pipelines

* update release pipeline

* update release pipeline

* update release version step

* ignore flaky test; remove CircleCI
  • Loading branch information
mafasva authored Mar 21, 2024
1 parent 50e18a6 commit ccc5927
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 271 deletions.
31 changes: 0 additions & 31 deletions .circleci/README.md

This file was deleted.

238 changes: 0 additions & 238 deletions .circleci/config.yml

This file was deleted.

85 changes: 85 additions & 0 deletions .github/workflows/create-release-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Create release branch

on:
workflow_dispatch:
branches: [ develop ]
inputs:
release:
description: 'Type of the release.'
type: choice
options:
- major
- minor
- patch
default: minor

jobs:
create_branch:
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/develop'

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Create version
id: createVersion
run: |
CURRENT_VERSION=$(mvn -q -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec)
echo "Current version: $CURRENT_VERSION"
MAJOR=`echo $CURRENT_VERSION | cut -d. -f1`
MINOR=`echo $CURRENT_VERSION | cut -d. -f2`
PATCH=`echo $CURRENT_VERSION | cut -d. -f3 | cut -d- -f1`
if [ ${{ inputs.release }} == 'major' ]; then
MAJOR=$((MAJOR+1))
MINOR=0
PATCH=0
elif [ ${{ inputs.release }} == 'minor' ]; then
MINOR=$((MINOR+1))
PATCH=0
else
PATCH=$((PATCH+1))
fi
VERSION=${MAJOR}.${MINOR}.${PATCH}
echo
echo "Release version: $VERSION"
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: Checkout
uses: actions/checkout@v4
- name: Create release branch
env:
VERSION: ${{ steps.createVersion.outputs.VERSION }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
git branch release/$VERSION
git checkout release/$VERSION
mvn versions:set -DnewVersion=${VERSION}-SNAPSHOT versions:commit
git add pom.xml
git commit -m "updated project version to ${VERSION}"
git push --set-upstream origin release/$VERSION
wrong_branch:
if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/develop'

runs-on: ubuntu-latest

steps:
- name: ERROR
run: echo 'This workflow only runs on develop branch!'
Loading

0 comments on commit ccc5927

Please sign in to comment.