diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 729eac2..81869a6 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -26,12 +26,20 @@ jobs: set -x yarn global add semver PATH="$(yarn global bin):$PATH" - LOCAL_VERSION="$(cat package.json | jq -r .version)" + + # take npm version and increment it PKG_NAME="$(cat package.json | jq .name)" NPM_VERSION="$(yarn info --silent "$PKG_NAME" version || true)" - MAX_VERSION="$(semver "$LOCAL_VERSION" "$NPM_VERSION" "0.0.0" | tail -n1)" - FINAL_VERSION="$(semver --increment patch "$MAX_VERSION")" - echo "FINAL_VERSION=$FINAL_VERSION" | tee -a $GITHUB_ENV + NEXT_NPM_VERSION="$(semver --increment patch "$NPM_VERSION")" + + # take local version + LOCAL_VERSION="$(cat package.json | jq -r .version)" + + # take maximum of the local and NEXT_NPM versions + MAX_VERSION="$(semver "$LOCAL_VERSION" "$NEXT_NPM_VERSION" "0.0.0" | tail -n1)" + + # save version to env + echo "FINAL_VERSION=$MAX_VERSION" | tee -a $GITHUB_ENV ### Set version - name: Set version to ${{ env.FINAL_VERSION }}