diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index dae6f5c..7701af7 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -17,6 +17,30 @@ permissions: jobs: + versioning: + name: Update Version + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + - name: Run TinySemVer + uses: ashvardanian/tinysemver@v2.0.7 + with: + verbose: "true" + version-file: "VERSION" + update-version-in: | + CMakeLists.txt:VERSION (\d+\.\d+\.\d+) + update-major-version-in: | + include/ucall/ucall.h:^#define UCALL_VERSION_MAJOR (\d+) + update-minor-version-in: | + include/ucall/ucall.h:^#define UCALL_VERSION_MINOR (\d+) + update-patch-version-in: | + include/ucall/ucall.h:^#define UCALL_VERSION_PATCH (\d+) + dry-run: "true" + test_python: name: Test Python runs-on: ${{ matrix.os }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d34e58a..bcfc283 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,17 +18,31 @@ permissions: jobs: versioning: - name: Semantic Release + name: Update Version runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - with: - persist-credentials: false - - uses: actions/setup-node@v3 - with: - node-version: 20 - - run: npm install --save-dev @semantic-release/exec @semantic-release/git conventional-changelog-eslint semantic-release && npx semantic-release - + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + - name: Run TinySemVer + uses: ashvardanian/tinysemver@v2.0.7 + with: + verbose: "true" + version-file: "VERSION" + update-version-in: | + CMakeLists.txt:VERSION (\d+\.\d+\.\d+) + update-major-version-in: | + include/ucall/ucall.h:^#define UCALL_VERSION_MAJOR (\d+) + update-minor-version-in: | + include/ucall/ucall.h:^#define UCALL_VERSION_MINOR (\d+) + update-patch-version-in: | + include/ucall/ucall.h:^#define UCALL_VERSION_PATCH (\d+) + dry-run: "false" + push: "true" + create-release: "true" + github-token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }} build_wheels: name: Build Python ${{ matrix.python-version }} for ${{ matrix.os }} diff --git a/.github/workflows/update_version.sh b/.github/workflows/update_version.sh deleted file mode 100644 index af88340..0000000 --- a/.github/workflows/update_version.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -echo $1 > VERSION && - sed -i "s/^\(#define UCALL_VERSION_MAJOR \).*/\1$(echo "$1" | cut -d. -f1)/" ./include/ucall/ucall.h && - sed -i "s/^\(#define UCALL_VERSION_MINOR \).*/\1$(echo "$1" | cut -d. -f2)/" ./include/ucall/ucall.h && - sed -i "s/^\(#define UCALL_VERSION_PATCH \).*/\1$(echo "$1" | cut -d. -f3)/" ./include/ucall/ucall.h && - sed -i "s/VERSION [0-9]\+\.[0-9]\+\.[0-9]\+/VERSION $1/" CMakeLists.txt diff --git a/.releaserc b/.releaserc deleted file mode 100644 index 6a5ae19..0000000 --- a/.releaserc +++ /dev/null @@ -1,84 +0,0 @@ -{ - "branches": [ - "main" - ], - "debug": true, - "ci": true, - "dryRun": false, - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "eslint", - "releaseRules": [ - { - "tag": "Break", - "release": "major" - }, - { - "tag": "Add", - "release": "minor" - }, - { - "tag": "Improve", - "release": "patch" - }, - { - "tag": "Make", - "release": "patch" - }, - { - "tag": "Refactor", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "eslint", - "releaseRules": [ - { - "tag": "Break", - "release": "major" - }, - { - "tag": "Add", - "release": "minor" - }, - { - "tag": "Improve", - "release": "patch" - }, - { - "tag": "Make", - "release": "patch" - }, - { - "tag": "Refactor", - "release": false - } - ] - } - ], - "@semantic-release/github", - [ - "@semantic-release/exec", - { - "prepareCmd": "bash .github/workflows/update_version.sh '${nextRelease.version}'" - } - ], - [ - "@semantic-release/git", - { - "assets": [ - "VERSION", - "CMakeLists.txt", - "include/ucall/ucall.h" - ], - "message": "Build: Released ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" - } - ] - ] -}