Skip to content

Commit

Permalink
ops: check version
Browse files Browse the repository at this point in the history
  • Loading branch information
gomeslucasm committed Apr 16, 2024
1 parent 11f48f1 commit d4d2635
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions .github/workflows/check-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,21 @@ on:
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
if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize')
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Check versions
run: |
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

0 comments on commit d4d2635

Please sign in to comment.