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-zap-logger.git


The following commit(s) were added to refs/heads/master by this push:
     new 503c28d  fix: reject release tags whose major version does not match 
go.mod
503c28d is described below

commit 503c28dc4fe114074966fa76af15b670a65308b8
Author: Yang Luo <[email protected]>
AuthorDate: Wed Oct 7 11:11:01 2026 +0800

    fix: reject release tags whose major version does not match go.mod
---
 .github/workflows/release.yml | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9341550..c418d51 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -56,12 +56,17 @@ jobs:
       - name: Verify go.mod matches the tag
         run: |
           set -euo pipefail
-          # Go only resolves vN.x.y tags for a module whose path ends in /vN 
(N >= 2).
+          # Go resolves vN.x.y tags (N >= 2) only for a module whose path ends 
in
+          # /vN, and v0 / v1 tags only for a module without such a suffix.
           MODULE="$(awk '/^module /{print $2; exit}' go.mod)"
           MAJOR="${GITHUB_REF_NAME#v}"
           MAJOR="${MAJOR%%.*}"
-          SUFFIX="${MODULE##*/}"
-          if [ "$MAJOR" -ge 2 ] && [ "$SUFFIX" != "v$MAJOR" ]; then
+          if [[ "${MODULE##*/}" =~ ^v([0-9]+)$ ]]; then
+            OK=$([ "$MAJOR" = "${BASH_REMATCH[1]}" ] && echo true || echo 
false)
+          else
+            OK=$([ "$MAJOR" -le 1 ] && echo true || echo false)
+          fi
+          if [ "$OK" != true ]; then
             echo "::error::go.mod declares $MODULE but the tag is 
$GITHUB_REF_NAME."
             exit 1
           fi


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

Reply via email to