Skip to content

Commit

Permalink
Merge pull request #40 from Trendyol/feature/issue-20
Browse files Browse the repository at this point in the history
#20 add version-check.yml
  • Loading branch information
MehmetFiratKomurcu authored Mar 20, 2024
2 parents d49097c + ccb9f71 commit 2889722
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
name: Build & push Docker image
with:
image: kafka-retry-job
tags: 1.12.1, latest
tags: 1.12.2, latest
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
Expand Down
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
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

variables:
VERSION: "1.12.1"
VERSION: "1.12.2"
DOCKER_IMAGE_VERSION: $GITLAB_REGISTRY_HOST/$CI_PROJECT_PATH:$VERSION
DOCKER_IMAGE_LATEST: $GITLAB_REGISTRY_HOST/$CI_PROJECT_PATH

Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [1.12.2](https://github.com/github-changelog-generator/github-changelog-generator/tree/1.16.4) (2024-03)

**Closed issues:**

- [\#20](https://github.com/Trendyol/kafka-retry-job/issues/36) Add version check workflow to compare main and current version

**Merged pull requests:**

- Pull Request for the issues #20 [\#40](https://github.com/Trendyol/kafka-retry-job/pull/40) ([semihcavdar](https://github.com/semihcavdar))

## [1.12.1](https://github.com/github-changelog-generator/github-changelog-generator/tree/1.16.4) (2024-02)

**Closed issues:**
Expand Down
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 2889722

Please sign in to comment.