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-casbin.js.git
The following commit(s) were added to refs/heads/master by this push:
new 5e9567f ci: replace semantic-release with manual tag-based release
5e9567f is described below
commit 5e9567fe92c5690b2eba06bc3b10a905156c8a05
Author: Yang Luo <[email protected]>
AuthorDate: Thu Aug 6 18:35:28 2026 +0800
ci: replace semantic-release with manual tag-based release
---
.github/workflows/ci.yml | 20 --------
.github/workflows/release.yml | 106 ++++++++++++++++++++++++++++++++++++++++++
.releaserc.json | 11 -----
package.json | 3 +-
4 files changed, 107 insertions(+), 33 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 75bb84f..1268885 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -39,23 +39,3 @@ jobs:
- name: Run Unit test
run: yarn run test
-
- semantic-release:
- needs: [ test ]
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - name: Use Node.js
- uses: actions/setup-node@v3
- with:
- node-version: '20.x'
-
- - name: Run semantic-release
- if: github.repository == 'apache/casbin-casbin.js' &&
github.event_name == 'push'
- run: |
- yarn install --no-lockfile
- yarn run prepack
- 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..f96b5a5
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,106 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Manual release. Releases are cut by pushing a tag by hand:
+#
+# vX.Y.Z-rcN -> GitHub *pre-release* only (the candidate to vote on)
+# vX.Y.Z -> GitHub release + publish to npm (after the vote passed)
+#
+# Both cases attach the same Apache source package. The release manager
+# downloads it, signs it locally and takes it to the vote.
+
+name: release
+
+on:
+ push:
+ tags:
+ - 'v*'
+
+permissions:
+ contents: write
+
+env:
+ # Base name of the Apache source package, without version/suffix.
+ ARTIFACT_PREFIX: apache-casbin-js
+
+jobs:
+ release:
+ if: github.repository == 'apache/casbin-casbin.js'
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Resolve version from tag
+ run: |
+ set -euo pipefail
+ TAG="${GITHUB_REF_NAME}"
+ if [[ ! "${TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$ ]]; then
+ echo "::error::Tag '${TAG}' is not a release tag. Expected vX.Y.Z
or vX.Y.Z-rcN."
+ exit 1
+ fi
+ FULL="${TAG#v}"
+ # The release candidate and the final release are the very same
+ # artifact, so the -rcN suffix never appears in the package name.
+ VERSION="${FULL%-rc*}"
+ if [[ "${FULL}" == *-rc* ]]; then PRERELEASE=true; else
PRERELEASE=false; fi
+ echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
+ echo "PRERELEASE=${PRERELEASE}" >> "${GITHUB_ENV}"
+ echo "SRC_NAME=${ARTIFACT_PREFIX}-${VERSION}-incubating-src" >>
"${GITHUB_ENV}"
+
+ - name: Build Apache source package
+ run: |
+ set -euo pipefail
+ git archive --format=tar.gz --prefix="${SRC_NAME}/" -o
"${SRC_NAME}.tar.gz" HEAD
+ sha512sum "${SRC_NAME}.tar.gz" > "${SRC_NAME}.tar.gz.sha512"
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '20.x'
+ registry-url: 'https://registry.npmjs.org'
+
+ - name: Install Dependency
+ run: yarn install
+
+ - name: Run Unit test
+ run: yarn run test
+
+ # An -rcN tag only ever produces a pre-release; the vote decides whether
+ # it is promoted, which happens by pushing the matching vX.Y.Z tag.
+ - name: Publish GitHub release
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ set -euo pipefail
+ FLAGS=""
+ if [[ "${PRERELEASE}" == "true" ]]; then FLAGS="--prerelease"; fi
+ gh release create "${GITHUB_REF_NAME}" \
+ --title "${GITHUB_REF_NAME}" \
+ --generate-notes \
+ ${FLAGS} \
+ "${SRC_NAME}.tar.gz" "${SRC_NAME}.tar.gz.sha512"
+
+ - name: Publish to npm
+ if: env.PRERELEASE == 'false'
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+ run: |
+ set -euo pipefail
+ npm version "${VERSION}" --no-git-tag-version --allow-same-version
+ npm publish --access public
diff --git a/.releaserc.json b/.releaserc.json
deleted file mode 100644
index bb32f34..0000000
--- a/.releaserc.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "branches": ["master"],
- "plugins": [
- "@semantic-release/commit-analyzer",
- "@semantic-release/release-notes-generator",
- "@semantic-release/changelog",
- "@semantic-release/npm",
- "@semantic-release/git",
- "@semantic-release/github"
- ]
-}
diff --git a/package.json b/package.json
index f1a2983..7ce7eea 100644
--- a/package.json
+++ b/package.json
@@ -22,8 +22,7 @@
"dev": "webpack --config webpack.dev.js",
"clean": "rimraf lib",
"prepack": "run-s build",
- "postpack": "run-s clean",
- "release": "npx -p semantic-release -p @semantic-release/git -p
@semantic-release/changelog semantic-release"
+ "postpack": "run-s clean"
},
"devDependencies": {
"@babel/plugin-proposal-optional-chaining": "^7.11.0",
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]