Skip to content

Commit

Permalink
Added release job and bump pom tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
mivek committed Apr 19, 2022
1 parent e6c7353 commit c533d77
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
19 changes: 4 additions & 15 deletions .github/workflows/bump-pom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,14 @@ jobs:
with:
java-version: '11'
distribution: 'adopt'

- name: Expose git commit data
uses: rlespinasse/[email protected]

- name: Bump pom patch version for fixes and clean
run: |
mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DprocessAllModules versions:commit
if: "contains(env.GIT_COMMIT_MESSAGE_SUBJECT , 'Merge pull request') &&
(contains(env.GIT_COMMIT_MESSAGE_SUBJECT , 'fix') || contains(env.GIT_COMMIT_MESSAGE_SUBJECT , 'clean'))"

- name: Bump pom minor version for feature
- name: Bump pom according to commit message name
run: |
mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0 -DprocessAllModules versions:commit
if: "contains(env.GIT_COMMIT_MESSAGE_SUBJECT , 'Merge pull request') && contains(env.GIT_COMMIT_MESSAGE_SUBJECT , 'feature')"
bash .github/workflows/scripts/bump-pom.sh
- name: Bump pom major version for major feature
run: |
mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0 -DprocessAllModules versions:commit
if: "contains(env.commit_message, 'Merge pull request') &&
(contains(env.GIT_COMMIT_MESSAGE_SUBJECT , 'clean') || contains(env.GIT_COMMIT_MESSAGE_SUBJECT , 'major'))"
- name: Retrieve the version
run: |
echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
Expand All @@ -43,4 +32,4 @@ jobs:
default_author: github_actions
message: Bump pom
tag: ${{ env.version }}
if: "contains(env.commit_message, 'Merge pull request')"
if: "contains(env.commit_message, 'Merge pull request')"
26 changes: 22 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,29 @@ jobs:
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Upload the Jars
- name: Create jar folder and copy all jars inside
run: |
mkdir jars
cp /**/target/*.jar jars/
uses: actions/upload-artifact@v2
with:
path: /**/target/*.jar
name: jars
path: jars/

# Remains upload jar artifacts
# Create the release https://github.com/marketplace/actions/gh-release?version=v0.1.5
release:
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions.checkout@v2

- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: jars/

- name: Create the release
uses: softprops/actions-gh-release@v1
with:
draft: true
files: /etc/usr/artifacts/**/*.jar
9 changes: 9 additions & 0 deletions .github/workflows/scripts/bump-pom.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

if [[ $GIT_COMMIT_MESSAGE_SUBJECT =~ (Merge pull request.*feature) ]];then
mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0 -DprocessAllModules versions:commit
elif [[ $GIT_COMMIT_MESSAGE_SUBJECT =~ (Merge pull request.*major) ]];then
mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.nextMajorVersion}.0.0 -DprocessAllModules versions:commit
else
mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DprocessAllModules versions:commit
fi

0 comments on commit c533d77

Please sign in to comment.