Release v0.3.0 #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
branches: | |
- master | |
jobs: | |
check-pr-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout PR branch | |
uses: actions/checkout@v3 | |
- name: Get version from PR branch | |
id: pr_version | |
run: | | |
PR_VERSION=$(grep '<Version>' **/*.csproj | sed -E 's/.*<Version>(.*)<\/Version>.*/\1/') | |
echo "PR_VERSION=$PR_VERSION" >> $GITHUB_ENV | |
- name: Checkout master branch | |
run: | | |
git fetch origin master | |
git checkout origin/master | |
- name: Get version from master branch | |
id: master_version | |
run: | | |
MASTER_VERSION=$(grep '<Version>' **/*.csproj | sed -E 's/.*<Version>(.*)<\/Version>.*/\1/') | |
echo "MASTER_VERSION=$MASTER_VERSION" >> $GITHUB_ENV | |
- name: Compare versions | |
run: | | |
if [ "$(printf '%s\n' "$PR_VERSION" "$MASTER_VERSION" | sort -V | head -n1)" = "$PR_VERSION" ] && [ "$PR_VERSION" != "$MASTER_VERSION" ]; then | |
echo "Version in PR is not higher than master." | |
exit 1 | |
else | |
echo "Version in PR is higher than master." | |
fi |