You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@casbin.apache.org by hs...@apache.org on 2026/08/06 13:08:54 UTC

(casbin-python-async-sqlalchemy-adapter) branch master updated: ci: replace semantic-release with manual tag-based release

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-async-sqlalchemy-adapter.git


The following commit(s) were added to refs/heads/master by this push:
     new edcfa42  ci: replace semantic-release with manual tag-based release
edcfa42 is described below

commit edcfa428249711561086d282da4b8b6005eb939a
Author: Yang Luo <hs...@gmail.com>
AuthorDate: Thu Aug 6 21:08:46 2026 +0800

    ci: replace semantic-release with manual tag-based release
---
 .github/workflows/build.yml   |  32 -----------
 .github/workflows/release.yml | 122 ++++++++++++++++++++++++++++++++++++++++++
 .releaserc.json               |  23 --------
 DISCLAIMER                    |  10 ++++
 NOTICE                        |   5 ++
 package.json                  |   8 ---
 pyproject.toml                |   4 +-
 7 files changed, 140 insertions(+), 64 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 06b2f95..a137dc8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -66,35 +66,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
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..d5c2f86
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,122 @@
+name: release
+
+# Releases are cut manually by pushing a git tag:
+#   * v1.4.0-rc1 -> GitHub *pre-release* only (the candidate used for the Apache vote)
+#   * v1.4.0     -> GitHub release + publish to PyPI (after the vote has passed)
+on:
+  push:
+    tags:
+      - 'v*'
+
+permissions:
+  contents: write
+
+env:
+  # Base name of the Apache source release artifact.
+  # Drop "incubating-" from ARTIFACT_SUFFIX once the project graduates.
+  PRODUCT_NAME: casbin-python-async-sqlalchemy-adapter
+  ARTIFACT_SUFFIX: incubating-src
+
+jobs:
+  release:
+    name: Release
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+
+      - name: Parse tag
+        id: meta
+        run: |
+          set -euo pipefail
+          tag="${GITHUB_REF_NAME}"
+          version="${tag#v}"
+          if [[ "$version" =~ ^([0-9]+\.[0-9]+\.[0-9]+)-rc([0-9]+)$ ]]; then
+            base="${BASH_REMATCH[1]}"
+            prerelease=true
+          elif [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
+            base="$version"
+            prerelease=false
+          else
+            echo "::error::Tag '$tag' is not supported. Use v<X.Y.Z> or v<X.Y.Z>-rc<N>, e.g. v1.4.0 or v1.4.0-rc1."
+            exit 1
+          fi
+
+          # The artifact is always named after the base version, so the tarball voted
+          # on as an RC is the very same tarball published for the final release.
+          {
+            echo "tag=$tag"
+            echo "base=$base"
+            echo "prerelease=$prerelease"
+            echo "artifact=apache-${PRODUCT_NAME}-${base}-${ARTIFACT_SUFFIX}"
+          } >> "$GITHUB_OUTPUT"
+
+      - name: Build source release
+        id: src
+        run: |
+          set -euo pipefail
+          name="${{ steps.meta.outputs.artifact }}"
+          base="${{ steps.meta.outputs.base }}"
+
+          # Plain source export from the tag: no VCS metadata, no binaries.
+          mkdir -p "srcdir/${name}"
+          git archive --format=tar "${GITHUB_REF_NAME}" | tar -x -C "srcdir/${name}"
+
+          # pyproject.toml carries a placeholder version; the tag is the source of truth.
+          sed -i -E "0,/^version = \".*\"/s//version = \"${base}\"/" "srcdir/${name}/pyproject.toml"
+          stamped="$(sed -nE '0,/^version = "(.*)"/s//\1/p' "srcdir/${name}/pyproject.toml")"
+          if [ "$stamped" != "$base" ]; then
+            echo "::error::Failed to stamp version '${base}' into pyproject.toml (got '${stamped}')."
+            exit 1
+          fi
+
+          for required in LICENSE NOTICE DISCLAIMER; do
+            if [ ! -f "srcdir/${name}/${required}" ]; then
+              echo "::error::${required} is missing from the source release."
+              exit 1
+            fi
+          done
+
+          # Deterministic tarball: same commit + same version => same bytes.
+          epoch="$(git log -1 --format=%ct "${GITHUB_REF_NAME}")"
+          tar --sort=name --mtime="@${epoch}" --owner=0 --group=0 --numeric-owner \
+            -cf "${name}.tar" -C srcdir "${name}"
+          gzip -n "${name}.tar"
+          sha512sum "${name}.tar.gz" > "${name}.tar.gz.sha512"
+
+          echo "tarball=${name}.tar.gz" >> "$GITHUB_OUTPUT"
+          echo "srcdir=srcdir/${name}" >> "$GITHUB_OUTPUT"
+
+      - name: Create GitHub release
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        run: |
+          set -euo pipefail
+          args=(--title "${{ steps.meta.outputs.tag }}" --generate-notes)
+          if [ "${{ steps.meta.outputs.prerelease }}" = "true" ]; then
+            args+=(--prerelease)
+          fi
+          gh release create "${{ steps.meta.outputs.tag }}" "${args[@]}" \
+            "${{ steps.src.outputs.tarball }}" \
+            "${{ steps.src.outputs.tarball }}.sha512"
+
+      - name: Set up Python
+        if: steps.meta.outputs.prerelease == 'false'
+        uses: actions/setup-python@v5
+        with:
+          python-version: '3.12'
+
+      - name: Build distributions
+        if: steps.meta.outputs.prerelease == 'false'
+        run: |
+          python -m pip install --upgrade build
+          # Built from the source release, so PyPI ships exactly what was voted on.
+          python -m build --outdir dist "${{ steps.src.outputs.srcdir }}"
+
+      - name: Publish to PyPI
+        if: steps.meta.outputs.prerelease == 'false'
+        uses: pypa/gh-action-pypi-publish@release/v1
+        with:
+          password: ${{ secrets.PYPI_TOKEN }}
diff --git a/.releaserc.json b/.releaserc.json
deleted file mode 100644
index 94e24cd..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", "pyproject.toml"]
-      }
-    ]
-  ]
-}
\ No newline at end of file
diff --git a/DISCLAIMER b/DISCLAIMER
new file mode 100644
index 0000000..732919a
--- /dev/null
+++ b/DISCLAIMER
@@ -0,0 +1,10 @@
+Apache Casbin is an effort undergoing incubation at the Apache Software
+Foundation (ASF), sponsored by the Apache Incubator PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..d415695
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,5 @@
+Apache Casbin (incubating)
+Copyright 2026 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (https://www.apache.org/).
diff --git a/package.json b/package.json
deleted file mode 100644
index 16bdf0f..0000000
--- a/package.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-    "devDependencies": {
-        "@semantic-release/changelog": "^6.0.3",
-        "@semantic-release/git": "^10.0.1",
-        "semantic-release": "^22.0.5",
-        "semantic-release-pypi": "^5.1.0"
-    }
-}
diff --git a/pyproject.toml b/pyproject.toml
index 37d1903..97e44ed 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,8 @@
 [project]
 name = "casbin_async_sqlalchemy_adapter"
-version = "1.17.0"
+# Placeholder only. The real version comes from the release tag: the release
+# workflow stamps it in when it builds the source package and the distributions.
+version = "0.0.0"
 authors = [
     {name = "Casbin", email = "admin@casbin.org"}
 ]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@casbin.apache.org
For additional commands, e-mail: commits-help@casbin.apache.org