From 22e8b94a905a6814b982a04b48872d90e13c8f09 Mon Sep 17 00:00:00 2001 From: Sergei Blinov Date: Sun, 8 Sep 2024 17:16:50 +0200 Subject: [PATCH] version ci --- .github/workflows/release.yaml | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..8283553 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,44 @@ +name: Release "afio" Font + +on: + push: + branches: + - main + - ci/* + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Get current version from tags + id: get_version + run: | + # Get the latest tag, filter to versions with "v" prefix, sort them by version, and take the latest + VERSION=$(git describe --tags --match "v[0-9]*" --abbrev=0 2>/dev/null || echo "v0.0.0") + echo "Current version: $VERSION" + echo "version=$VERSION" >> $GITHUB_ENV + + - name: Bump patch version + id: bump_version + run: | + # Strip the "v" and split into major, minor, patch + VERSION=${{ env.version }} + VERSION_NUMBER=$(echo $VERSION | sed 's/v//') + MAJOR=$(echo $VERSION_NUMBER | cut -d. -f1) + MINOR=$(echo $VERSION_NUMBER | cut -d. -f2) + PATCH=$(echo $VERSION_NUMBER | cut -d. -f3) + NEW_VERSION="v$MAJOR.$MINOR.$((PATCH + 1))" + echo "New version: $NEW_VERSION" + echo "new_version=$NEW_VERSION" >> $GITHUB_ENV + + - name: Tag the new version + run: | + git tag ${{ env.new_version }} + git push origin ${{ env.new_version }}