Skip to content

Commit

Permalink
#20 add version-check.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
semih.cavdar committed Mar 20, 2024
1 parent d49097c commit 6a8b7e9
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/version-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Version Check

on:
push:
branches:
- '**'

jobs:
verify-version:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get version
id: version
run: |
version=$(git show HEAD:.github/workflows/publish.yml | awk '/tags/{print $2}' | sed 's/,$//')
echo "version=$version" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v2
with:
ref: main

- name: Get main version
id: main_version
run: |
main_version=$(git show HEAD:.github/workflows/publish.yml | awk '/tags/{print $2}' | sed 's/,$//')
echo "main_version=$main_version" >> $GITHUB_ENV
- name: Use Output
id: output
run: |
echo "current_version : $version"
echo "main_version : $main_version"
- name: Compare versions
id: compare_versions
run: |
IFS='.' read -ra version_parts <<< "$version"
IFS='.' read -ra main_version_parts <<< "$main_version"
for i in "${!version_parts[@]}"; do
if [ "${version_parts[i]}" -lt "${main_version_parts[i]}" ]; then
echo "$version is less than $main_version"
exit 1
elif [ "${version_parts[i]}" -gt "${main_version_parts[i]}" ]; then
echo "$version is greater than $main_version"
exit 0
fi
done
if [ "${version_parts[@]}" != "${main_version_parts[@]}" ]; then
echo "Error: $main_version is greater than $version"
exit 1
fi
echo "Please update the version. Current version: $version is equal to previous version: $main_version"
exit 1
1 change: 1 addition & 0 deletions kafka-retry-job.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ProjectSection(SolutionItems) = preProject
version_check.sh = version_check.sh
.github\workflows\publish.yml = .github\workflows\publish.yml
.github\workflows\test.yml = .github\workflows\test.yml
.github\workflows\version-check.yml = .github\workflows\version-check.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "kafka.retry.job.tests", "tests\kafka.retry.job.tests.csproj", "{7C35FE3D-43A2-418D-8DF3-94383DE6FE2E}"
Expand Down

0 comments on commit 6a8b7e9

Please sign in to comment.