-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add job checking if version is bumped on feature branch.
- Loading branch information
1 parent
032efc8
commit 66d1a93
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: ⬆️ Check Version Bump | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout source branch | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
path: source | ||
|
||
- name: Checkout target branch | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.base.sha }} | ||
path: target | ||
|
||
- name: Compare versions | ||
id: compare_versions | ||
run: | | ||
SOURCE_VERSION=$(awk '/^Version:/ { print $2 }' source/DESCRIPTION) | ||
TARGET_VERSION=$(awk '/^Version:/ { print $2 }' target/DESCRIPTION) | ||
echo "Source package version: $SOURCE_VERSION" | ||
echo "Target package version: $TARGET_VERSION" | ||
if [ "$SOURCE_VERSION" == "$TARGET_VERSION" ]; then | ||
echo "Versions are identical" | ||
echo "::set-output name=versions_identical::true" | ||
else | ||
echo "Versions differ" | ||
echo "::set-output name=versions_identical::false" | ||
fi | ||
- name: Fail if versions are identical | ||
if: steps.compare_versions.outputs.versions_identical == 'true' | ||
run: | | ||
echo "The package versions are identical between the source and target branches." | ||
exit 1 |