Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#20 add version-check.yml #40

Merged
merged 3 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading