Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GITHUB_ENV file instead of set-env command #534

Merged
merged 7 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/diktat_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down