diff --git a/.github/workflows/diktat_snapshot.yml b/.github/workflows/diktat_snapshot.yml index 76033fb5c5..37fa345dfb 100644 --- a/.github/workflows/diktat_snapshot.yml +++ b/.github/workflows/diktat_snapshot.yml @@ -24,16 +24,17 @@ jobs: restore-keys: | ${{ runner.os }}-maven-build - name: Set version - # set project version which will then be used to run diktat from local maven repo - # base version is stored in env variable for later usage + # Set project version which will then be used to run diktat from local maven repo. + # Base version is stored in env variable for later usage. + # Note: maven-help-plugin requires non-interactive mode (do not add -B flag). run: | - snapshot_version=$(printf 'VERSION=${project.version}\n0\n' | mvn -B help:evaluate | grep '^VERSION' | cut -d= -f2) + snapshot_version=$(printf 'VERSION=${project.version}\n0\n' | mvn help:evaluate | grep '^VERSION' | cut -d= -f2) base_version=${snapshot_version%-SNAPSHOT} - echo ::set-env name=BASE_VERSION::$base_version + echo "BASE_VERSION=$base_version" >> $GITHUB_ENV mvn -B versions:set -DnewVersion=$base_version-pre - name: Build and install # install diktat with version 'base_version-pre' to local maven repo - run: mvn -B clean install -DskipTests=true + run: mvn -B clean install -DskipTests=true --projects diktat-maven-plugin --also-make - name: Revert project version and set proper version for diktat check # revert project version to avoid cycle dependency # set diktat version in plugin dependencies to the version which was built in the previous step diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31a31b1544..4e76dc0a35 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,9 +28,11 @@ jobs: env: DIKTAT_GPG_PUB: ${{ secrets.DIKTAT_PGP_PUB }} DIKTAT_GPG_SEC: ${{ secrets.DIKTAT_PGP_SEC }} + # Note: maven-help-plugin requires non-interactive mode (do not add -B flag). run: | - echo ::set-env name=PREVIOUS_VERSION::$(printf 'VERSION=${diktat-check.version}\n0\n' | mvn help:evaluate | grep '^VERSION' | cut -d= -f2) - echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#'refs/tags/v'} + previous_version=$(printf 'VERSION=${diktat-check.version}\n0\n' | mvn help:evaluate | grep '^VERSION' | cut -d= -f2) + echo "PREVIOUS_VERSION=$previous_version" >> $GITHUB_ENV + echo "RELEASE_VERSION=${GITHUB_REF#'refs/tags/v'}" >> $GITHUB_ENV echo "$DIKTAT_GPG_PUB" > ~/diktat.pubring.gpg echo "$DIKTAT_GPG_SEC" > ~/diktat.secring.gpg gpg --import ~/diktat.pubring.gpg