From a20a8cb94542e018c50e5da856c6a3575f3d535d Mon Sep 17 00:00:00 2001 From: Le Karasique Date: Mon, 12 Jul 2021 16:09:22 +0300 Subject: [PATCH] Fix release workflow (#95) --- .github/workflows/mvn-publish.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/mvn-publish.yml b/.github/workflows/mvn-publish.yml index fa9914b..0afe31b 100644 --- a/.github/workflows/mvn-publish.yml +++ b/.github/workflows/mvn-publish.yml @@ -2,10 +2,10 @@ name: Publish packages to OSSRH on: push: - branches: + branches: - master - version-[0-9].[0-9]+.x - tags: + tags: - v[0-9].[0-9]+.[0-9]+ pull_request: @@ -27,9 +27,11 @@ jobs: mvn_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) git_ref=${GITHUB_REF##*/} pr_number=${{ github.event.number }} - if [[ $git_ref =~ v[0-9]+\.[0-9]+\.[0-9]+$ && v$mvn_version != $git_ref ]] ; then - echo Maven version $mvn_version does not match tag $git_ref - exit 1 + if [[ $git_ref =~ v[0-9]+\.[0-9]+\.[0-9]+$ ]] ; then + if [[ v$mvn_version != $git_ref ]] ; then + echo Maven version $mvn_version does not match tag $git_ref + exit 1 + fi elif [[ $pr_number != "" && $mvn_version =~ -SNAPSHOT$ ]] ; then pattern="s/(.+)-SNAPSHOT/\1-"$pr_number"-SNAPSHOT/g" mvn_version=$(echo $mvn_version | sed -E $pattern)