Merge pull request #470 from paritytech/automated-update-metadata #35
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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
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 'action@github.com' | |
git tag $CURRENT_TAG | |
git push origin $CURRENT_TAG | |
echo "The version has updated" | |
fi |