Merge pull request #527 from paritytech/dependabot/cargo/url-2.4.1 #82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Set version tag | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
set-version-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.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 |