diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml new file mode 100644 index 0000000..01fe358 --- /dev/null +++ b/.github/workflows/tag-release.yml @@ -0,0 +1,35 @@ +name: Tag release + +on: + push: + branches: + - main + - test + +jobs: + tag: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Get package.json version + run: | + VERSION=$(grep '"version"' package.json | head -1 | sed -E 's/.*"version": *"([^"]+)".*/\1/') + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "Tag to create: v$VERSION" + + - name: Configure Git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Create Git tag + run: | + # проверяем, есть ли уже такой тег + if git rev-parse "v$VERSION" >/dev/null 2>&1; then + echo "Tag v$VERSION already exists, skipping creation." + else + git tag -a "v$VERSION" -m "Release v$VERSION" + git push origin "v$VERSION" + fi diff --git a/package.json b/package.json index 91849d1..ebff2cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.baltin.fbt", - "version": "0.5.2", + "version": "0.5.3", "displayName": "FunctionalBT", "description": "Functional Behavior Tree Design Pattern Implementation", "unity": "2019.3",