ci(actions): Auto update tag for patch build (#3387)
Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
This commit is contained in:
parent
b2e961d621
commit
80ffa15959
1 changed files with 1 additions and 10 deletions
11
.github/workflows/update-tag.yaml
vendored
11
.github/workflows/update-tag.yaml
vendored
|
|
@ -27,20 +27,11 @@ jobs:
|
||||||
"https://api.github.com/repos/${{ github.repository }}/releases/latest" \
|
"https://api.github.com/repos/${{ github.repository }}/releases/latest" \
|
||||||
| jq -r .tag_name)
|
| jq -r .tag_name)
|
||||||
|
|
||||||
GIT_LATEST_TAG=$(git tag --list 'v[0-9]*' --sort=-v:refname | head -n 1)
|
|
||||||
# Fallback to git command if API doesn't return a tag
|
# Fallback to git command if API doesn't return a tag
|
||||||
if [ "$LATEST_TAG" == "null" ] || [ -z "$LATEST_TAG" ]; then
|
if [ "$LATEST_TAG" == "null" ] || [ -z "$LATEST_TAG" ]; then
|
||||||
echo "Not found latest tag"
|
echo "Not found latest tag"
|
||||||
exit 100
|
exit 100
|
||||||
fi
|
fi
|
||||||
if [ "$GIT_LATEST_TAG" == "null" ] || [ -z "$GIT_LATEST_TAG" ]; then
|
|
||||||
echo "Not found git latest tag"
|
|
||||||
exit 100
|
|
||||||
fi
|
|
||||||
if [ "$GIT_LATEST_TAG" != "$LATEST_TAG" ]; then
|
|
||||||
echo "Latest tag in git repo doesn't match latest tag in GitHub. Exiting."
|
|
||||||
exit 100
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
|
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
|
||||||
echo "Latest tag: $LATEST_TAG"
|
echo "Latest tag: $LATEST_TAG"
|
||||||
|
|
@ -55,4 +46,4 @@ jobs:
|
||||||
git fetch --tags
|
git fetch --tags
|
||||||
git checkout main
|
git checkout main
|
||||||
echo "Updating tag ${{ env.LATEST_TAG }} to point to latest commit on main"
|
echo "Updating tag ${{ env.LATEST_TAG }} to point to latest commit on main"
|
||||||
git push origin HEAD:refs/tags/${{ env.LATEST_TAG }} --force
|
git push origin HEAD:refs/tags/${{ env.LATEST_TAG }} --force
|
||||||
Loading…
Add table
Reference in a new issue