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-python-redis-adapter.git


The following commit(s) were added to refs/heads/master by this push:
     new bb808b6  fix: use approved actions in CI and release on tags only
bb808b6 is described below

commit bb808b615d2f55570051922ec113b941f6ba586e
Author: Yang Luo <[email protected]>
AuthorDate: Fri Oct 9 22:59:20 2026 +0800

    fix: use approved actions in CI and release on tags only
---
 .github/workflows/build.yml   | 68 +++++++++++-------------------
 .github/workflows/release.yml | 98 +++++++++++++++++++++++++++++++++++++++++++
 .releaserc.json               | 23 ----------
 MANIFEST.in                   |  1 +
 4 files changed, 123 insertions(+), 67 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ab4a9a0..00124fe 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -14,18 +14,26 @@ jobs:
         python-version: ['3.10', '3.11', '3.12']
         os: [ubuntu-latest]
 
+    services:
+      redis:
+        image: redis:7
+        ports:
+          - 6379:6379
+        options: >-
+          --health-cmd "redis-cli ping"
+          --health-interval 5s
+          --health-timeout 3s
+          --health-retries 10
+
     steps:
     - name: Checkout
-      uses: actions/checkout@v2
+      uses: actions/checkout@v4
 
     - name: Set up Python ${{ matrix.python-version }}
-      uses: actions/setup-python@v2
+      uses: actions/setup-python@v5
       with:
         python-version: ${{ matrix.python-version }}
 
-    - name: Set up Redis
-      uses: nnhy/[email protected]
-
     - name: Install dependencies
       run: |
         pip install -r requirements.txt
@@ -46,14 +54,18 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - name: Checkout
-        uses: actions/checkout@v2
+        uses: actions/checkout@v4
+
+      - name: Set up Python
+        uses: actions/setup-python@v5
+        with:
+          python-version: '3.12'
 
-      - name: Super-Linter
-        uses: github/[email protected]
-        env:
-          VALIDATE_PYTHON_BLACK: true
-          DEFAULT_BRANCH: master
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      - name: Install black
+        run: pip install black==26.5.1
+
+      - name: Check formatting with black
+        run: black --check --diff .
 
   coveralls:
     name: Indicate completion to coveralls.io
@@ -67,35 +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@v2
-        with:
-          fetch-depth: 0
-
-      - name: Setup Node.js
-        uses: actions/setup-node@v2
-        with:
-          node-version: '20'
-
-      - name: Setup
-        run: npm install -g semantic-release @semantic-release/github 
@semantic-release/changelog @semantic-release/commit-analyzer 
@semantic-release/git @semantic-release/release-notes-generator 
semantic-release-pypi
-
-      - name: Set up python
-        uses: actions/setup-python@v2
-        with:
-          python-version: '3.12'
-
-      - name: Install setuptools
-        run: python -m pip install --upgrade setuptools wheel twine
-
-      - name: Release
-        env:
-          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
-        run: npx semantic-release
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..b2cfb54
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,98 @@
+name: release
+
+# Releases are triggered manually by pushing a git tag:
+#   - v1.6.0-rc1  -> GitHub pre-release (the candidate used for the Apache 
vote)
+#   - v1.6.0      -> GitHub release + publish to PyPI
+on:
+  push:
+    tags:
+      - "v*"
+
+permissions:
+  contents: write
+
+jobs:
+  release:
+    name: Release ${{ github.ref_name }}
+    if: github.repository == 'apache/casbin-python-redis-adapter'
+    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.6.0-rc1 -> 1.6.0-rc1, v1.6.0 -> 1.6.0
+          VERSION="${TAG#v}"
+          if ! echo "$VERSION" | grep -Eq 
'^[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$'; then
+            echo "::error::Tag $TAG is not vX.Y.Z or vX.Y.Z-rcN."
+            exit 1
+          fi
+          # 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 setup.cfg
+          # has to be bumped and committed before the tag is pushed.
+          PROJECT_VERSION="$(python -c "import configparser; c = 
configparser.ConfigParser(); c.read('setup.cfg'); 
print(c['metadata']['version'])")"
+          if [ "$PROJECT_VERSION" != "$BASE_VERSION" ]; then
+            echo "::error::tag $TAG expects version $BASE_VERSION in 
setup.cfg, found $PROJECT_VERSION"
+            exit 1
+          fi
+
+          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-python-redis-adapter-${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 twine
+          python -m build
+          twine check dist/*
+
+      - 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-python-redis-adapter-*-incubating-src.tar.gz \
+            apache-casbin-python-redis-adapter-*-incubating-src.tar.gz.sha512
+
+      - name: Publish to PyPI
+        if: steps.version.outputs.prerelease == 'false'
+        env:
+          TWINE_USERNAME: __token__
+          TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
+        run: twine upload dist/*
diff --git a/.releaserc.json b/.releaserc.json
deleted file mode 100644
index d05ce0c..0000000
--- a/.releaserc.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-  "branches": "master",
-  "plugins": [
-    "@semantic-release/commit-analyzer",
-    "@semantic-release/release-notes-generator",
-    "semantic-release-pypi",
-    "@semantic-release/github",
-    [
-      "@semantic-release/changelog",
-      {
-        "changelogFile": "CHANGELOG.md",
-        "changelogTitle": "# Semantic Versioning Changelog"
-      }
-    ],
-         [
-      "@semantic-release/git",
-      {
-        "message": "chore(release): ${nextRelease.version} [skip 
ci]\n\n${nextRelease.notes}",
-        "assets": ["CHANGELOG.md", "setup.py", "setup.cfg"]
-      }
-    ]
-  ]
-}
\ No newline at end of file
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..f9bd145
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1 @@
+include requirements.txt


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

Reply via email to