ops: check version changes #4
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: | ||
- development | ||
- master | ||
paths: | ||
- "src/**" | ||
jobs: | ||
version-check: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' && github.event.action == 'opened' || github.event.action == 'synchronize' | ||
script: | ||
- TARGET_BRANCH=$CI_MERGE_REQUEST_TARGET_BRANCH_NAME | ||
- TARGET_VERSION=$(git show origin/$TARGET_BRANCH:src/package.json | grep '"version"' | cut -d '"' -f 4) | ||
- CURRENT_VERSION=$(cat src/package.json | grep '"version"' | cut -d '"' -f 4) | ||
- echo "Versão na branch $TARGET_BRANCH: $TARGET_VERSION" | ||
- echo "Versão na branch atual: $CURRENT_VERSION" | ||
- if [ "$TARGET_VERSION" == "$CURRENT_VERSION" ]; then | ||
echo "Erro: Version is equal, change version to publish changes on NPM!"; | ||
exit 1; | ||
else | ||
echo "Different versions, changes will be published"; | ||
fi | ||