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-server.git
The following commit(s) were added to refs/heads/master by this push:
new 6fb780e feat: replace semantic-release with tag-triggered releases
6fb780e is described below
commit 6fb780e4e8425fe52ec17c7cef18db977fff09cd
Author: Yang Luo <[email protected]>
AuthorDate: Sat Oct 10 09:39:40 2026 +0800
feat: replace semantic-release with tag-triggered releases
---
.github/workflows/ci.yml | 28 ++++++++
.github/workflows/default.yml | 94 --------------------------
.github/workflows/release.yml | 154 ++++++++++++++++++++++++++++++++++++++++++
.releaserc.json | 16 -----
README.md | 20 ++----
5 files changed, 189 insertions(+), 123 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..305ac6b
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,28 @@
+name: CI
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+
+jobs:
+
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up Go
+ uses: actions/setup-go@v5
+ with:
+ go-version: '1.19'
+
+ - uses: actions/checkout@v4
+ - name: Run tests
+ run: go test -race -covermode atomic -coverprofile=profile.cov ./...
+ - name: Install goveralls
+ run: go install github.com/mattn/goveralls@latest
+
+ - name: Send coverage
+ env:
+ COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: goveralls -coverprofile=profile.cov -service=github
diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml
deleted file mode 100644
index 61e913d..0000000
--- a/.github/workflows/default.yml
+++ /dev/null
@@ -1,94 +0,0 @@
-name: Build
-
-on: [ push, pull_request ]
-
-jobs:
- coveralls:
- name: Test with Coverage
- runs-on: ubuntu-latest
- steps:
- - name: Set up Go
- uses: actions/setup-go@v2
- with:
- go-version: '1.19'
- - name: Check out code
- uses: actions/checkout@v3
- - name: Install dependencies
- run: |
- go mod download
- - name: Run Unit tests
- run: |
- go test -race -covermode atomic -coverprofile=covprofile ./...
- - name: Install goveralls
- run: go install github.com/mattn/goveralls@latest
- - name: Send coverage
- env:
- COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: goveralls -coverprofile=covprofile -service=github
-
- release-and-push:
- name: Release And Push
- runs-on: ubuntu-latest
- if: github.repository == 'casbin/casbin-server' && github.event_name ==
'push'
- needs: [ coveralls ]
- steps:
- - name: Checkout
- uses: actions/checkout@v2
-
- - name: Fetch Previous version
- id: get-previous-tag
- uses: actions-ecosystem/[email protected]
-
- - name: Run semantic-release
- run: |
- npm install --save-dev [email protected]
- npx semantic-release
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Fetch Current version
- id: get-current-tag
- uses: actions-ecosystem/[email protected]
-
- - name: Decide Should Push Or Not
- id: should_push
- run: |
- old_version=${{steps.get-previous-tag.outputs.tag}}
- new_version=${{steps.get-current-tag.outputs.tag }}
- old_array=(${old_version//\./ })
- new_array=(${new_version//\./ })
- if [ ${old_array[0]} != ${new_array[0]} ]
- then
- echo ::set-output name=push::'true'
- elif [ ${old_array[1]} != ${new_array[1]} ]
- then
- echo ::set-output name=push::'true'
-
- else
- echo ::set-output name=push::'false'
-
- fi
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v2
-
- - name: Set up buildx
- id: buildx
- uses: docker/setup-buildx-action@v2
- with:
- version: latest
-
- - name: Log in to Docker Hub
- uses: docker/login-action@v1
- if: github.repository == 'casbin/casbin-server' && github.event_name
== 'push' && steps.should_push.outputs.push=='true'
- with:
- username: ${{ secrets.DOCKERHUB_USERNAME }}
- password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
- - name: Push to Docker Hub
- uses: docker/build-push-action@v3
- if: github.repository == 'casbin/casbin-server' && github.event_name
== 'push' && steps.should_push.outputs.push=='true'
- with:
- target: STANDARD
- platforms: linux/amd64,linux/arm64
- push: true
- tags: casbin/casbin-server:${{steps.get-current-tag.outputs.tag
}},casbin/casbin-server:latest
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..cadf1dd
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,154 @@
+name: Release
+
+# Releases are cut by hand: nothing here runs on a merge, only on a pushed tag.
+#
+# v1.10.0-rc1 -> GitHub pre-release (the candidate put up for the Apache
vote)
+# v1.10.0 -> GitHub release + push the Docker image
+#
+# 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-server
+
+jobs:
+ release:
+ name: Release ${{ github.ref_name }}
+ if: github.repository == 'apache/casbin-server'
+ runs-on: ubuntu-latest
+ outputs:
+ version: ${{ steps.version.outputs.base_version }}
+ prerelease: ${{ steps.version.outputs.prerelease }}
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v4
+
+ - name: Resolve version from tag
+ id: version
+ run: |
+ set -euo pipefail
+ VERSION="${GITHUB_REF_NAME#v}"
+ # v1.10.0-rc1 -> 1.10.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
+ # Anything that is neither vX.Y.Z nor vX.Y.Z-rcN is a typo, and a
typo
+ # must not reach Docker Hub.
+ 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 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%%.*}"
+ 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
+
+ - 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[@]}"
+
+ docker:
+ name: Build and Push Docker Image
+ needs: release
+ # Release candidates exist only for the vote; they never reach a registry.
+ if: needs.release.outputs.prerelease == 'false'
+ runs-on: ubuntu-latest
+ env:
+ VERSION: ${{ needs.release.outputs.version }}
+ steps:
+ - name: Check the Docker Hub credentials are configured
+ id: gate
+ env:
+ DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
+ run: |
+ if [ -n "${DOCKERHUB_PASSWORD}" ]; then
+ echo "enabled=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "enabled=false" >> "$GITHUB_OUTPUT"
+ echo "::warning::DOCKERHUB_PASSWORD is not set, so no Docker image
was pushed for ${VERSION}."
+ fi
+
+ - name: Checkout Repository
+ if: steps.gate.outputs.enabled == 'true'
+ uses: actions/checkout@v4
+
+ - name: Set up QEMU
+ if: steps.gate.outputs.enabled == 'true'
+ uses:
docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
+
+ - name: Set up Docker Buildx
+ if: steps.gate.outputs.enabled == 'true'
+ uses:
docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
+
+ - name: Log in to Docker Hub
+ if: steps.gate.outputs.enabled == 'true'
+ uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f #
v4.6.0
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_PASSWORD }}
+
+ - name: Build and push Docker image
+ if: steps.gate.outputs.enabled == 'true'
+ uses:
docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
+ with:
+ context: .
+ target: STANDARD
+ push: true
+ tags: |
+ casbin/casbin-server:latest
+ casbin/casbin-server:${{ env.VERSION }}
+ platforms: linux/amd64,linux/arm64
diff --git a/.releaserc.json b/.releaserc.json
deleted file mode 100644
index 58cb0bb..0000000
--- a/.releaserc.json
+++ /dev/null
@@ -1,16 +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 7266c24..361df63 100644
--- a/README.md
+++ b/README.md
@@ -2,17 +2,14 @@ Casbin Server
====
<p align="center">
- <a href="#badge">
- <img alt="semantic-release"
src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
- </a>
<a href="https://hub.docker.com/r/casbin/casbin-server">
<img alt="docker pull casbin/casbin-server"
src="https://img.shields.io/docker/pulls/casbin/casbin-server.svg">
</a>
- <a
href="https://github.com/casbin/casbin-server/actions/workflows/default.yml">
- <img alt="GitHub Workflow Status (branch)"
src="https://github.com/casbin/casbin-server/workflows/Build/badge.svg?style=flat-square">
+ <a href="https://github.com/apache/casbin-server/actions/workflows/ci.yml">
+ <img alt="GitHub Workflow Status (branch)"
src="https://github.com/apache/casbin-server/actions/workflows/ci.yml/badge.svg">
</a>
- <a href="https://github.com/casbin/casbin-server/releases/latest">
- <img alt="GitHub Release"
src="https://img.shields.io/github/v/release/casbin/casbin-server.svg">
+ <a href="https://github.com/apache/casbin-server/releases/latest">
+ <img alt="GitHub Release"
src="https://img.shields.io/github/v/release/apache/casbin-server.svg">
</a>
<a href="https://coveralls.io/github/casbin/casbin-server?branch=master">
<img alt="Coverage Status"
src="https://coveralls.io/repos/github/casbin/casbin-server/badge.svg?branch=master">
@@ -23,11 +20,8 @@ Casbin Server
</p>
<p align="center">
- <a href="https://goreportcard.com/report/github.com/casbin/casbin-server">
- <img alt="Go Report Card"
src="https://goreportcard.com/badge/github.com/casbin/casbin-server?style=flat-square">
- </a>
- <a href="https://github.com/casbin/casbin-server/blob/master/LICENSE">
- <img
src="https://img.shields.io/github/license/casbin/casbin-server?style=flat-square"
alt="license">
+ <a href="https://github.com/apache/casbin-server/blob/master/LICENSE">
+ <img
src="https://img.shields.io/github/license/apache/casbin-server?style=flat-square"
alt="license">
</a>
<a href="https://discord.gg/5rPsrAzK7S">
<img alt="Discord"
src="https://img.shields.io/discord/1022748306096537660?style=flat-square&logo=discord&label=discord&color=5865F2">
@@ -76,7 +70,7 @@ Alternatively, you can also [run it from an
IDE](https://github.com/casbin/casbi
Similar to Casbin, Casbin-Server also uses adapters to provide policy storage.
However, because Casbin-Server is a service instead of a library, the adapters
have to be implemented inside Casbin-Server. As Golang is a static language,
each adapter requires to import 3rd-party library for that database. We cannot
import all those 3rd-party libraries inside Casbin-Server's code, as it causes
dependency overhead.
-For now, [Gorm
Adapter](https://github.com/casbin/casbin-server/blob/master/server/adapter.go)
(with ``mssql``, ``mysql``, ``postgres``), MongoDB und Redis Adapter are
built-in imports all commented. If you want to use ``Gorm Adapter`` with one of
those databases, you should uncomment that import line, or add your own import,
or even use another adapter by modifying Casbin-Server's source code.
+For now, [Gorm
Adapter](https://github.com/apache/casbin-server/blob/master/server/adapter.go)
(with ``mssql``, ``mysql``, ``postgres``), MongoDB und Redis Adapter are
built-in imports all commented. If you want to use ``Gorm Adapter`` with one of
those databases, you should uncomment that import line, or add your own import,
or even use another adapter by modifying Casbin-Server's source code.
To allow Casbin-Server to be production-ready, the adapter configuration
supports environment variables. For example, assume we created a ``postgres``
database for our RBAC model and want Casbin-Server to use it. Assuming that the
environment in which the Casbin-Server runs contains the necessary variables,
we can simply use the ``$ENV_VAR`` notation to provide these to the adapter.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]