Skip to content

[ci] Fix buildah (#547) #96

[ci] Fix buildah (#547)

[ci] Fix buildah (#547) #96

name: Set version tag
on:
push:
branches:
- master
jobs:
set-version-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0
- name: Push new version if exists
run: |
LATEST_TAG=$(git describe --tags --abbrev=0)
echo "Latest tag is ${LATEST_TAG}"
CURRENT_TAG=v$(awk -F ' = ' '$1 ~ /version/ { gsub(/[\"]/, "", $2); printf("%s",$2) }' Cargo.toml)
echo "Current tag is ${CURRENT_TAG}"
if [ "$LATEST_TAG" = "$CURRENT_TAG" ]; then
echo "The version hasn't changed"
else
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git tag $CURRENT_TAG
git push origin $CURRENT_TAG
echo "The version has updated"
fi