From c533d774bce21e8080f66cf4c1a02923086d73a5 Mon Sep 17 00:00:00 2001 From: Jk Date: Sun, 29 Aug 2021 12:09:04 +0200 Subject: [PATCH] Added release job and bump pom tasks --- .github/workflows/bump-pom.yml | 19 ++++--------------- .github/workflows/deploy.yml | 26 ++++++++++++++++++++++---- .github/workflows/scripts/bump-pom.sh | 9 +++++++++ 3 files changed, 35 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/scripts/bump-pom.sh diff --git a/.github/workflows/bump-pom.yml b/.github/workflows/bump-pom.yml index c56d8e8e..8578ac0a 100644 --- a/.github/workflows/bump-pom.yml +++ b/.github/workflows/bump-pom.yml @@ -13,25 +13,14 @@ jobs: with: java-version: '11' distribution: 'adopt' + - name: Expose git commit data uses: rlespinasse/git-commit-data-action@v1.x - - 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 @@ -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')" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 724634a4..23849dd4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 diff --git a/.github/workflows/scripts/bump-pom.sh b/.github/workflows/scripts/bump-pom.sh new file mode 100644 index 00000000..9d9dfdb6 --- /dev/null +++ b/.github/workflows/scripts/bump-pom.sh @@ -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