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-typeorm-adapter.git


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

commit 00d1998ce39de262006f946eb1e5670d2be02bdd
Author: Yang Luo <[email protected]>
AuthorDate: Mon Aug 3 17:18:55 2026 +0800

    ci: replace semantic-release with tag-triggered release workflow
---
 .github/workflows/ci.yml      |  21 ---------
 .github/workflows/release.yml | 101 ++++++++++++++++++++++++++++++++++++++++++
 package.json                  |   1 -
 3 files changed, 101 insertions(+), 22 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 80436ec..496abb1 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -93,24 +93,3 @@ jobs:
 
       - name: Run Unit test
         run: yarn run test
-
-  semantic-release:
-    needs: [lint, test, coverage]
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v4
-
-      - name: Set up Node.js
-        uses: actions/setup-node@v4
-        with:
-          node-version: ^20
-
-      - name: Run semantic-release
-        if: github.repository == 'apache/casbin-typeorm-adapter' && 
github.event_name == 'push'
-        run: |
-          yarn install
-          yarn run prepublish
-          yarn run release
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..1aafbd7
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,101 @@
+name: Release
+
+# Releases are cut manually, following the Apache release process. Whether a
+# tag publishes anything is decided by its name: release candidates only get
+# verified, and the final tag is pushed only after the vote has passed.
+#
+#   1. Bump "version" in package.json to the final version (e.g. 1.4.0) and
+#      merge that commit. Candidates never carry an -rcN version: the "rc"
+#      lives in the tag only, so the commit under vote and the commit that
+#      ships are byte for byte identical.
+#   2. Tag the release candidate and push it, e.g.:
+#        git tag -a v1.4.0-rc1 -m "Release candidate v1.4.0-rc1"
+#        git push origin v1.4.0-rc1
+#      This only runs lint/test/build as a gate -- nothing is published,
+#      because an artifact that has not passed a vote must not be distributed
+#      to the public. The release manager signs the source tarball and stages
+#      it under dist.apache.org/repos/dist/dev/ for the vote.
+#   3. Once the vote passes, tag that same commit as the final version:
+#        git tag -a v1.4.0 -m "Release v1.4.0" && git push origin v1.4.0
+#      A tag without a pre-release suffix is the only thing that publishes to
+#      npm and to GitHub Releases.
+#
+#   If the vote does not pass, fix the problem and roll a new candidate
+#   (v1.4.0-rc2). The final tag is never pushed until a vote has passed.
+#
+# Nothing is ever published from a branch push or a merged pull request.
+
+on:
+  push:
+    tags:
+      - 'v*'
+
+permissions:
+  contents: write
+
+jobs:
+  release:
+    if: github.repository == 'apache/casbin-typeorm-adapter'
+    runs-on: ubuntu-latest
+    services:
+      mysql:
+        image: mysql:8
+        env:
+          MYSQL_ROOT_PASSWORD: password
+          MYSQL_DATABASE: casbin
+        ports:
+          - 3306:3306
+        options: >-
+          --health-cmd="mysqladmin ping"
+          --health-interval=10s
+          --health-timeout=5s
+          --health-retries=10
+    steps:
+      - uses: actions/checkout@v4
+
+      - name: Set up Node.js
+        uses: actions/setup-node@v4
+        with:
+          node-version: ^20
+          registry-url: https://registry.npmjs.org
+
+      - name: Install Dependency
+        run: yarn install
+
+      # Both v1.4.0-rc1 and v1.4.0 must point at a commit whose package.json
+      # says 1.4.0, so the candidate and the release are the same content.
+      - name: Check tag matches package.json version
+        run: |
+          TAG_VERSION="${GITHUB_REF_NAME#v}"
+          BASE_VERSION="${TAG_VERSION%%-*}"
+          PKG_VERSION="$(node -p "require('./package.json').version")"
+          if [ "$BASE_VERSION" != "$PKG_VERSION" ]; then
+            echo "Tag $GITHUB_REF_NAME implies version $BASE_VERSION, but 
package.json says $PKG_VERSION" >&2
+            exit 1
+          fi
+
+      - name: Run Lint
+        run: yarn run lint
+
+      - name: Run Unit test
+        run: yarn run test
+
+      - name: Build
+        run: yarn run build
+
+      # Release candidates (v1.4.0-rc1) stop here: an artifact that has not
+      # passed a vote must not be published to npm or to a GitHub Release.
+      - name: Publish to npm
+        if: ${{ !contains(github.ref_name, '-') }}
+        run: npm publish --access public
+        env:
+          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+
+      - name: Create GitHub Release
+        if: ${{ !contains(github.ref_name, '-') }}
+        run: |
+          gh release create "$GITHUB_REF_NAME" \
+            --title "$GITHUB_REF_NAME" \
+            --generate-notes
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/package.json b/package.json
index 0792fec..3bb9ba8 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,6 @@
     "lint": "eslint \"src/**/*.{ts,js,jsx}\"",
     "fix": "eslint \"src/**/*.{ts,js,jsx}\" --fix",
     "test": "jest --runInBand",
-    "release": "npx -p semantic-release -p @semantic-release/git -p 
@semantic-release/changelog semantic-release",
     "prepare": "npm run build"
   },
   "devDependencies": {


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

Reply via email to