Skip to content

Commit

Permalink
push.yml update with version change (#141)
Browse files Browse the repository at this point in the history
Co-authored-by: Lee Sungjin <[email protected]>
  • Loading branch information
yhm1620 and sodyn99 authored May 31, 2024
1 parent a44da3b commit b2798b3
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,46 @@ jobs:
make images
docker push ${{ env.DOCKER_REPOSITORY }}onos-kpimon:${{ env.DOCKER_TAG }}
- name: Get changes
id: version-file
run: |
if git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep VERSION; then
echo "changed=true" >> $GITHUB_OUTPUT
version_before=$(git show ${{ github.event.before }}:VERSION)
echo "version_before=$version_before" >> $GITHUB_OUTPUT
else
echo "VERSION file was not changed"
fi
- name: Validate change in version file
id: version-change
if: steps.version-file.outputs.changed == 'true'
run: |
version=$(cat VERSION)
version_before_full=${{ steps.version-file.outputs.version_before }}
version_before=${version_before_full::-4}
echo "version=$version"
echo "version_before=$version_before"
validate="^[0-9]+\.[0-9]+\.[0-9]+$"
if [[ $version =~ $validate ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "version=$version" >> $GITHUB_OUTPUT
else
echo "Version change not for release"
fi
if [[ $version_before =~ $validate ]]; then
IFS='.' read -r major minor patch <<< "$version"
IFS='.' read -r major_b minor_b patch_b <<< "$version_before"
if [[ "$major" -ne "$major_b" ]] || [[ "$minor" -ne "$minor_b" ]]; then
version_branch="$major_b.$minor_b"
echo "release_branch=true" >> $GITHUB_OUTPUT
echo "version_branch=$version_branch" >> $GITHUB_OUTPUT
fi
else
echo "Version change not for branch release"
fi
# CAUTION: Other actions depend on this name "tag-github"
tag-github:
runs-on: ubuntu-latest
Expand Down

0 comments on commit b2798b3

Please sign in to comment.