add tags #6
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: CI | |
on: | |
push: | |
paths-ignore: | |
- "src/GeoLite2-City.mmdb" | |
workflow_dispatch: | |
jobs: | |
create-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: create tag | |
run: | | |
git fetch --tags origin | |
revlist="$(git rev-list --tags --max-count=1)" | |
echo "$revlist" | |
if [ -z "$revlist" ]; then | |
latestVersion="1.0.0" | |
else | |
latestVersion="$(git describe --tags "$revlist")" | |
fi | |
echo "$latestVersion" | |
latestVersionPrefix="$(awk -F'.' '{ $NF=""; print }' <<< "$latestVersion" | tr " " ".")" | |
echo "$latestVersionPrefix" | |
latestMinorVersion="$(sed "s/$latestVersionPrefix//g" <<< "$latestVersion")" | |
echo "$latestMinorVersion" | |
newMinorVersion=$(( $latestMinorVersion + 1 )) | |
echo "$newMinorVersion" | |
newVersion="$latestVersionPrefix$newMinorVersion" | |
echo "$newVersion" | |
git tag "$newVersion" | |
git push origin "$newVersion" || exit 1 |