Readme improvement #5
This file contains hidden or 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
| name: Check Version Mismatch between PR branch and master. | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| permissions: | |
| contents: read | |
| jobs: | |
| check-version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout PR branch | |
| uses: actions/checkout@v4 | |
| - name: Get version from PR | |
| id: pr_version | |
| run: | | |
| PR_VERSION=$(grep -Po 'KinesisVideoProducerCpp VERSION \K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt) | |
| echo "PR_VERSION=$PR_VERSION" >> "$GITHUB_ENV" | |
| echo "PR Version: $PR_VERSION" | |
| - name: Checkout master branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: master | |
| - name: Get version from master | |
| id: master_version | |
| run: | | |
| MASTER_VERSION=$(grep -Po 'KinesisVideoProducerCpp VERSION \K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt) | |
| echo "MASTER_VERSION=$MASTER_VERSION" >> "$GITHUB_ENV" | |
| echo "Master version: $MASTER_VERSION" | |
| - name: Compare versions | |
| run: | | |
| echo "Comparing PR Version: $PR_VERSION with Master Version: $MASTER_VERSION" | |
| if [ "$MASTER_VERSION" == "$PR_VERSION" ]; then | |
| echo "Please update the version in CMakeLists.txt file (project(KinesisVideoProducerCpp VERSION <ver-string> LANGUAGES C). Any PR getting merged to master requires a version update" | |
| exit 1 | |
| else | |
| echo "Version update detected." | |
| fi |