Skip to content

Commit

Permalink
Increment patch version on pre-release changes
Browse files Browse the repository at this point in the history
Previously, the patch version did not increment when there were pre-release changes. This update ensures the patch number increases if the current pre-release does not match the latest git commit.
  • Loading branch information
jaroslawherod committed Nov 20, 2024
1 parent 4d43350 commit 320352c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
11 changes: 10 additions & 1 deletion .github/scripts/next_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ VERSION_MINOR_PATCH="${VERSION#*.}"
VERSION_MINOR="${VERSION_MINOR_PATCH%%.*}"
VERSION_PATCH_PRE_RELEASE="${VERSION_MINOR_PATCH#*.}"
VERSION_PATCH="${VERSION_PATCH_PRE_RELEASE%%[-+]*}"

VERSION_PRE_RELEASE=""
case "$VERSION" in
*-*)
VERSION_PRE_RELEASE="${VERSION#*-}"
VERSION_PRE_RELEASE="${VERSION_PRE_RELEASE%%+*}"
;;
esac
if [[ "${VERSION_MAJOR}" != "$(date '+%Y')" ]]; then
VERSION_MAJOR="$(date '+%Y')"
VERSION_MINOR="$(date '+%-m')"
Expand All @@ -27,6 +33,9 @@ elif [[ "${VERSION_MINOR}" != "$(date '+%-m')" ]]; then
VERSION_MINOR="$(date '+%-m')"
VERSION_PATCH="0"
fi
if [[ "${VERSION_PRE_RELEASE}" != "${GIT_COMMIT}" ]];then
VERSION_PATCH=$((VERSION_PATCH+1))
fi

case "$PREFIX" in
"stable" )
Expand Down
28 changes: 15 additions & 13 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ on:
branches:
- develop
- main
- feature/release-of-stable-version

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
# unit_tests:
# uses: ./.github/workflows/test-unit.yaml
# secrets: inherit
unit_tests:
uses: ./.github/workflows/test-unit.yaml
secrets: inherit
release_image:
runs-on: ubuntu-latest
# needs:
# - unit_tests
needs:
- unit_tests
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -35,11 +34,11 @@ jobs:
registry: ${{ secrets.GCR_URL }}
username: ${{ secrets.GCR_USERNAME }}
password: ${{ secrets.GCR_PASSWORD }}
# - name: Build and push datareporter
# uses: docker/build-push-action@v6
# with:
# push: true
# tags: europe-west1-docker.pkg.dev/datareporter/datareporter/datareporter:${{ steps.get-version.outputs.version }}
- name: Build and push datareporter
uses: docker/build-push-action@v6
with:
push: true
tags: europe-west1-docker.pkg.dev/datareporter/datareporter/datareporter:${{ steps.get-version.outputs.version }}

- name: Build and push plywood
uses: docker/build-push-action@v6
Expand All @@ -50,5 +49,8 @@ jobs:
- name: Tag release
shell: bash
run: |
git tag ${{ steps.get-version.outputs.version }}
git push --tags
if ! [ $(git rev-list ${{ steps.get-version.outputs.version }} >/dev/null )];
then
git tag ${{ steps.get-version.outputs.version }}
git push --tags
fi

0 comments on commit 320352c

Please sign in to comment.