This is an automated email from the ASF dual-hosted git repository.

hsluoyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/casbin-pycasbin.git


The following commit(s) were added to refs/heads/master by this push:
     new 24dab22  feat: release via manual git tag instead of semantic-release
24dab22 is described below

commit 24dab2215e39baa8c2048fb5faf47697d99db8ca
Author: Yang Luo <[email protected]>
AuthorDate: Tue Aug 4 14:12:24 2026 +0800

    feat: release via manual git tag instead of semantic-release
---
 .github/workflows/build.yml   | 29 --------------
 .github/workflows/release.yml | 92 +++++++++++++++++++++++++++++++++++++++++++
 .releaserc.json               |  9 -----
 package.json                  |  6 ---
 4 files changed, 92 insertions(+), 44 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 99c03a5..7ac55df 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -79,32 +79,3 @@ jobs:
           coveralls --finish
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
-  release:
-    name: Release
-    runs-on: ubuntu-latest
-    needs: [test, coveralls]
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v4
-        with:
-          fetch-depth: 0
-
-      - name: Setup Node.js
-        uses: actions/setup-node@v4
-        with:
-          node-version: "20"
-
-      - name: Setup
-        run: npm install
-
-      - name: Set up python
-        uses: actions/setup-python@v5
-        with:
-          python-version: 3.11
-
-      - name: Release
-        env:
-          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          PYPI_TOKEN: ${{ secrets.PYPI_TOKEN_CASBIN }}
-        run: npx semantic-release
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..0ccfdfc
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,92 @@
+name: release
+
+# Releases are triggered manually by pushing a git tag:
+#   - v1.4.0-rc1  -> GitHub pre-release (the candidate used for the Apache 
vote)
+#   - v1.4.0      -> GitHub release + publish to PyPI
+on:
+  push:
+    tags:
+      - "v*"
+
+permissions:
+  contents: write
+
+jobs:
+  release:
+    name: Release
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Set up Python
+        uses: actions/setup-python@v5
+        with:
+          python-version: "3.12"
+
+      - name: Resolve version from tag
+        id: version
+        run: |
+          set -euo pipefail
+          TAG="${GITHUB_REF_NAME}"
+          # v1.4.0-rc1 -> 1.4.0-rc1, v1.4.0 -> 1.4.0
+          VERSION="${TAG#v}"
+          # The release candidate is voted on as the final version, so strip 
"-rcN".
+          BASE_VERSION="${VERSION%%-rc*}"
+          if [ "$VERSION" != "$BASE_VERSION" ]; then
+            PRERELEASE=true
+          else
+            PRERELEASE=false
+          fi
+
+          # The source release must describe its own version, so pyproject.toml
+          # has to be bumped and committed before the tag is pushed.
+          PROJECT_VERSION="$(python -c "import tomllib; 
print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")"
+          if [ "$PROJECT_VERSION" != "$BASE_VERSION" ]; then
+            echo "::error::tag $TAG expects version $BASE_VERSION in 
pyproject.toml, found $PROJECT_VERSION"
+            exit 1
+          fi
+
+          echo "version=$VERSION" >> "$GITHUB_OUTPUT"
+          echo "base_version=$BASE_VERSION" >> "$GITHUB_OUTPUT"
+          echo "prerelease=$PRERELEASE" >> "$GITHUB_OUTPUT"
+
+      - name: Build Apache source release
+        env:
+          BASE_VERSION: ${{ steps.version.outputs.base_version }}
+        run: |
+          set -euo pipefail
+          NAME="apache-casbin-pycasbin-${BASE_VERSION}-incubating-src"
+          git archive --format=tar.gz --prefix="${NAME}/" -o "${NAME}.tar.gz" 
HEAD
+          sha512sum "${NAME}.tar.gz" > "${NAME}.tar.gz.sha512"
+
+      - name: Build Python distributions
+        if: steps.version.outputs.prerelease == 'false'
+        run: |
+          python -m pip install --upgrade build
+          python -m build
+
+      - name: Create GitHub release
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          TAG: ${{ github.ref_name }}
+          PRERELEASE: ${{ steps.version.outputs.prerelease }}
+        run: |
+          set -euo pipefail
+          if [ "$PRERELEASE" = "true" ]; then
+            FLAGS="--prerelease"
+          else
+            FLAGS="--latest"
+          fi
+          gh release create "$TAG" \
+            --title "$TAG" \
+            --generate-notes \
+            $FLAGS \
+            apache-casbin-pycasbin-*-incubating-src.tar.gz \
+            apache-casbin-pycasbin-*-incubating-src.tar.gz.sha512
+
+      - name: Publish to PyPI
+        if: steps.version.outputs.prerelease == 'false'
+        uses: pypa/gh-action-pypi-publish@release/v1
+        with:
+          password: ${{ secrets.PYPI_TOKEN_CASBIN }}
diff --git a/.releaserc.json b/.releaserc.json
deleted file mode 100644
index e5ee572..0000000
--- a/.releaserc.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-  "branches": "master",
-  "plugins": [
-    "@semantic-release/commit-analyzer",
-    "@semantic-release/release-notes-generator",
-    "semantic-release-pypi",
-    "@semantic-release/github"
-  ]
-}
\ No newline at end of file
diff --git a/package.json b/package.json
deleted file mode 100644
index c171e46..0000000
--- a/package.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-    "devDependencies": {
-        "semantic-release": "^22.0.5",
-        "semantic-release-pypi": "^5.1.0"
-    }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to