Skip to content

Improve Loadable

Improve Loadable #10

name: Increment Version
on:
push:
branches:
- main
jobs:
tag:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Fetch all tags
run: git fetch --tags
- name: Check if the latest commit is already tagged
run: |
if [ $(git rev-parse --abbrev-ref HEAD) = "main" ]; then
if git describe --exact-match --tags $(git rev-parse HEAD); then
echo "Latest commit has tag."
exit 0
fi
fi
- name: Get the latest tag
run: |
TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "LATEST_TAG=$TAG" >> $GITHUB_ENV
- name: Increment version
run: |
if [ -z "$LATEST_TAG" ]; then
VERSION="0.0.0"
else
VERSION=$(echo $LATEST_TAG | awk -F. '{print $1"."$2"."$3+1}')
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create git tag
run: |
git tag "$VERSION"
git push origin "$VERSION"