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/10/07 03:00:22 UTC
(casbin-zap-logger) 02/02: feat: replace semantic-release with a tag-triggered release workflow
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
commit 6e64c98aaf70f19b3c4118f440a19b7e7210682f
Author: Yang Luo <hs...@gmail.com>
AuthorDate: Wed Oct 7 10:48:54 2026 +0800
feat: replace semantic-release with a tag-triggered release workflow
---
.github/workflows/ci.yml | 18 ---------
.github/workflows/release.yml | 92 +++++++++++++++++++++++++++++++++++++++++++
.releaserc.json | 17 --------
README.md | 3 --
4 files changed, 92 insertions(+), 38 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3b879e1..2d525b9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -26,21 +26,3 @@ jobs:
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=profile.cov -service=github
-
- semantic-release:
- needs: [ test ]
- runs-on: ubuntu-latest
- steps:
-
- - uses: actions/checkout@v2
- - name: Setup Node.js
- uses: actions/setup-node@v3
- with:
- node-version: 20
- - name: Run semantic-release
- if: github.repository == 'casbin/zap-logger' && github.event_name == 'push'
- run: |
- npm install --save-dev semantic-release@17.2.4
- npx semantic-release
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..9341550
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,92 @@
+name: Release
+
+# Releases are cut by hand: nothing here runs on a merge, only on a pushed tag.
+#
+# v3.0.0-rc1 -> GitHub pre-release (the candidate put up for the Apache vote)
+# v3.0.0 -> GitHub release; Go users pick the module up from the tag
+#
+# Either way the release carries an Apache-style source tarball as its only
+# asset. The release manager downloads that tarball and signs / checksums it
+# locally before starting the vote; nothing is signed or uploaded here.
+
+on:
+ push:
+ tags:
+ - "v*"
+
+permissions:
+ contents: write
+
+env:
+ # Base name of the source release artifact, per Apache naming conventions.
+ ARTIFACT_BASENAME: apache-casbin-zap-logger
+
+jobs:
+ release:
+ name: Release ${{ github.ref_name }}
+ if: github.repository == 'apache/casbin-zap-logger'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v4
+
+ - name: Resolve version from tag
+ id: version
+ run: |
+ set -euo pipefail
+ VERSION="${GITHUB_REF_NAME#v}"
+ # v3.0.0-rc1 -> 3.0.0. The tarball the PPMC votes on is the exact tarball
+ # that ships, so the candidate counter is never part of its name.
+ BASE_VERSION="${VERSION%%-rc*}"
+ if [ "$VERSION" = "$BASE_VERSION" ]; then
+ PRERELEASE=false
+ else
+ PRERELEASE=true
+ fi
+ if ! echo "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$'; then
+ echo "::error::Tag $GITHUB_REF_NAME is not vX.Y.Z or vX.Y.Z-rcN."
+ exit 1
+ fi
+ {
+ echo "base_version=$BASE_VERSION"
+ echo "prerelease=$PRERELEASE"
+ } >> "$GITHUB_OUTPUT"
+ echo "Tag $GITHUB_REF_NAME -> version $BASE_VERSION (pre-release: $PRERELEASE)"
+
+ - 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).
+ 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
+ echo "::error::go.mod declares $MODULE but the tag is $GITHUB_REF_NAME."
+ exit 1
+ fi
+
+ - name: Build source release tarball
+ id: package
+ run: |
+ set -euo pipefail
+ NAME="${ARTIFACT_BASENAME}-${{ steps.version.outputs.base_version }}-incubating-src"
+ ASSET="${RUNNER_TEMP}/${NAME}.tar.gz"
+ # git archive gives us exactly the tracked sources at this tag, unpacking
+ # into a single top-level directory named after the release.
+ git archive --format=tar.gz --prefix="$NAME/" -o "$ASSET" HEAD
+ echo "asset=$ASSET" >> "$GITHUB_OUTPUT"
+ ls -l "$ASSET"
+
+ - name: Publish GitHub release
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ TAG: ${{ github.ref_name }}
+ ASSET: ${{ steps.package.outputs.asset }}
+ run: |
+ set -euo pipefail
+ FLAGS=(--title "$TAG" --generate-notes)
+ if [ "${{ steps.version.outputs.prerelease }}" = "true" ]; then
+ FLAGS+=(--prerelease)
+ fi
+ gh release create "$TAG" "$ASSET" "${FLAGS[@]}"
diff --git a/.releaserc.json b/.releaserc.json
deleted file mode 100644
index 297a14e..0000000
--- a/.releaserc.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "debug": true,
- "branches": [
- "+([0-9])?(.{+([0-9]),x}).x",
- "master",
- {
- "name": "beta",
- "prerelease": true
- }
- ],
- "plugins": [
- "@semantic-release/commit-analyzer",
- "@semantic-release/release-notes-generator",
- "@semantic-release/github"
- ]
- }
-
diff --git a/README.md b/README.md
index e93c490..5efb694 100644
--- a/README.md
+++ b/README.md
@@ -3,9 +3,6 @@
<h3 align="center">Zap logger is the Zap logger for Casbin. With this library, Casbin can log information more powerful.</h3>
<div class="labels">
<p align="center">
- <a href="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
- <img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg" alt="semantic-release">
- </a>
<a href="https://goreportcard.com/report/github.com/casbin/zap-logger">
<img src="https://goreportcard.com/badge/github.com/casbin/zap-logger" alt="Go Report Card">
</a>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@casbin.apache.org
For additional commands, e-mail: commits-help@casbin.apache.org