Skip to content

Commit

Permalink
(BI-5157) feat: move to semver
Browse files Browse the repository at this point in the history
  • Loading branch information
ovsds committed Dec 20, 2023
1 parent 02a53cc commit df092b3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 20 deletions.
8 changes: 4 additions & 4 deletions .github/.scripts/shift_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ if [[ -z $version_shift ]]; then
exit 1;
fi

if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "ERROR: Version must be in format X.Y.Z, found $version, exiting..."
if [[ ! $version =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "ERROR: Version must be in format vX.Y.Z, found $version, exiting..."
exit 1;
fi

major=$(echo "$version" | cut -d. -f1)
major=$(echo "$version" | cut -d. -f1 | cut -dv -f2)
minor=$(echo "$version" | cut -d. -f2)
patch=$(echo "$version" | cut -d. -f3)

Expand All @@ -42,4 +42,4 @@ case "$version_shift" in
;;
esac

echo "${major}.${minor}.${patch}"
echo "v${major}.${minor}.${patch}"
11 changes: 2 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
inputs:
version:
type: string
description: "Version to release"
description: "Version to release, in format 'vX.Y.Z'"
make_latest:
type: boolean
description: "Make latest"
Expand All @@ -28,7 +28,7 @@ jobs:
- "datalens-data-api"
env:
cr_url: "ghcr.io/${{ github.repository_owner }}"
image_url_rc: "ghcr.io/${{ github.repository_owner }}/${{ matrix.image_name }}:${{ github.event.inputs.version }}rc1"
image_url_rc: "ghcr.io/${{ github.repository_owner }}/${{ matrix.image_name }}:${{ github.event.inputs.version }}-rc.1"

steps:
- name: Log in to the Container registry
Expand Down Expand Up @@ -63,13 +63,6 @@ jobs:
branch: "release/${{ github.event.inputs.version }}"

steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v2
with:
ref: "${{ env.branch }}"
fetch-depth: 0

- name: Create release
id: create_release
working-directory: .github/.scripts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_create_hotfix_branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
inputs:
version:
type: string
description: "Version to use as hotfix base, patch version will be increased"
description: "Version to use as hotfix base, patch version will be increased, in format 'vX.Y.Z'"
cherry_pick_commits:
type: string
description: "Commits to cherry pick, separated by space"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release_prerelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
inputs:
version:
type: string
description: "Version to release"
description: "Version to release, in format 'vX.Y.Z'"
version_shift:
type: choice
description: "Version shift, used if version is not specified"
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
version=${{ github.event.inputs.version }}
if [[ -z "${version}" ]]; then
latest_tag=$(git describe --tags --abbrev=0)
latest_version="${latest_tag%rc*}"
latest_version="${latest_tag%-rc.*}"
echo "Latest version is ${latest_version}"
version=$(.github/.scripts/shift_version.sh ${latest_version} ${{ github.event.inputs.version_shift }})
fi
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
--set "${bake_target}.tags=${{ env.image_url_rc }}"
${{ github.event.inputs.with_release == 'true' && '--set "${bake_target}.tags=${{ env.image_url_release }}"' || '' }}
env:
image_url_rc: "${{ env.cr_url }}/${{ matrix.image_name }}:${{ env.version }}rc1"
image_url_rc: "${{ env.cr_url }}/${{ matrix.image_name }}:${{ env.version }}-rc.1"
image_url_release: "${{ env.cr_url }}/${{ matrix.image_name }}:${{ env.version }}"

release:
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
--generate-notes
env:
GH_TOKEN: ${{ github.token }}
release_tag: "${{ env.version }}rc1"
release_tag: "${{ env.version }}-rc.1"

- name: Create release
id: create_release
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_protect_branches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
exit 1;
fi
if [[ -n $(git tag -l "${version}rc*") ]]; then
echo "Release candidate tag ${version}rc* already exists, thus this branch cannot be changed."
if [[ -n $(git tag -l "${version}-rc.*") ]]; then
echo "Release candidate tag ${version}-rc.* already exists, thus this branch cannot be changed."
exit 1;
fi

0 comments on commit df092b3

Please sign in to comment.