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/08/04 05:28:39 UTC
(casbin-jcasbin) branch master updated: feat: replace auto release with manual tag-driven release
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-jcasbin.git
The following commit(s) were added to refs/heads/master by this push:
new 0ab8750 feat: replace auto release with manual tag-driven release
0ab8750 is described below
commit 0ab8750f3cb6c48e0bc24dbe335abfec037f8256
Author: Yang Luo <hs...@gmail.com>
AuthorDate: Tue Aug 4 13:28:30 2026 +0800
feat: replace auto release with manual tag-driven release
---
.github/workflows/maven-ci.yml | 85 ---------
.../{maven-snapshot.yml => maven-publish.yml} | 2 +-
.github/workflows/release.yml | 189 +++++++++++++++++++++
.github/workflows/source-release-draft.yml | 125 --------------
.github/workflows/source-snapshot.yml | 113 ------------
5 files changed, 190 insertions(+), 324 deletions(-)
diff --git a/.github/workflows/maven-ci.yml b/.github/workflows/maven-ci.yml
index de3d9a8..70be2c9 100644
--- a/.github/workflows/maven-ci.yml
+++ b/.github/workflows/maven-ci.yml
@@ -30,88 +30,3 @@ jobs:
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
-
- prepare_snapshot_version:
- name: Prepare Snapshot Version
- needs: build
- if: ${{ github.repository == 'apache/casbin-jcasbin' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
- runs-on: ubuntu-latest
- outputs:
- version: ${{ steps.snapshot.outputs.version }}
- maven_version: ${{ steps.snapshot.outputs.maven_version }}
- basename: ${{ steps.snapshot.outputs.basename }}
- previous_tag: ${{ steps.snapshot.outputs.previous_tag }}
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
-
- - name: Compute snapshot version
- id: snapshot
- run: |
- LATEST_RELEASE_TAG="$(
- git tag --list 'v*' |
- grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' |
- sort -V |
- tail -n 1
- )"
-
- if [ -z "${LATEST_RELEASE_TAG}" ]; then
- BASE_VERSION="0.1.0"
- else
- RELEASE_VERSION="${LATEST_RELEASE_TAG#v}"
- MAJOR="${RELEASE_VERSION%%.*}"
- REST="${RELEASE_VERSION#*.}"
- MINOR="${REST%%.*}"
- NEXT_MINOR="$((MINOR + 1))"
- BASE_VERSION="${MAJOR}.${NEXT_MINOR}.0"
- fi
-
- ESCAPED_BASE_VERSION="${BASE_VERSION//./\\.}"
- LAST_SNAPSHOT_NUMBER="$(
- git tag --list "v${BASE_VERSION}-snapshot.*" |
- sed -nE "s/^v${ESCAPED_BASE_VERSION}-snapshot\\.([0-9]+)$/\\1/p" |
- sort -n |
- tail -n 1
- )"
- LAST_SNAPSHOT_NUMBER="${LAST_SNAPSHOT_NUMBER:-0}"
- NEXT_SNAPSHOT_NUMBER="$((LAST_SNAPSHOT_NUMBER + 1))"
- SNAPSHOT_VERSION="v${BASE_VERSION}-snapshot.${NEXT_SNAPSHOT_NUMBER}"
- MAVEN_VERSION="${SNAPSHOT_VERSION#v}"
- BASENAME="jcasbin-${MAVEN_VERSION}-src"
-
- echo "version=${SNAPSHOT_VERSION}" >> "${GITHUB_OUTPUT}"
- echo "maven_version=${MAVEN_VERSION}" >> "${GITHUB_OUTPUT}"
- echo "basename=${BASENAME}" >> "${GITHUB_OUTPUT}"
- if [ "${LAST_SNAPSHOT_NUMBER}" -gt 0 ]; then
- echo "previous_tag=v${BASE_VERSION}-snapshot.${LAST_SNAPSHOT_NUMBER}" >> "${GITHUB_OUTPUT}"
- else
- echo "previous_tag=${LATEST_RELEASE_TAG}" >> "${GITHUB_OUTPUT}"
- fi
-
- echo "Computed snapshot version: ${SNAPSHOT_VERSION}"
- echo "Computed Maven version: ${MAVEN_VERSION}"
-
- publish-maven:
- name: Publish Maven
- needs: prepare_snapshot_version
- if: ${{ github.repository == 'apache/casbin-jcasbin' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
- uses: ./.github/workflows/maven-snapshot.yml
- with:
- maven_version: ${{ needs.prepare_snapshot_version.outputs.maven_version }}
- secrets: inherit
-
- semantic-release:
- name: Semantic Release
- needs:
- - prepare_snapshot_version
- - publish-maven
- if: ${{ github.repository == 'apache/casbin-jcasbin' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
- permissions:
- contents: write
- uses: ./.github/workflows/source-snapshot.yml
- with:
- version: ${{ needs.prepare_snapshot_version.outputs.version }}
- basename: ${{ needs.prepare_snapshot_version.outputs.basename }}
- previous_tag: ${{ needs.prepare_snapshot_version.outputs.previous_tag }}
diff --git a/.github/workflows/maven-snapshot.yml b/.github/workflows/maven-publish.yml
similarity index 98%
rename from .github/workflows/maven-snapshot.yml
rename to .github/workflows/maven-publish.yml
index eb11c32..4ba9a09 100644
--- a/.github/workflows/maven-snapshot.yml
+++ b/.github/workflows/maven-publish.yml
@@ -9,7 +9,7 @@ on:
workflow_dispatch:
inputs:
maven_version:
- description: Maven release version to publish, for example 1.2.3-snapshot.1
+ description: Maven release version to publish, for example 1.2.3
required: true
type: string
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..4e5aa94
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,189 @@
+name: Release
+
+# Releases are cut manually by pushing a git tag:
+# v1.4.0-rc1 -> GitHub pre-release only (source package for the Apache vote)
+# v1.4.0 -> GitHub release + publish to Maven Central
+#
+# The release manager downloads the source package from the release, signs it
+# locally, and uses it for voting. This workflow does not sign anything.
+
+on:
+ push:
+ tags:
+ - "v*"
+
+permissions:
+ contents: write
+
+jobs:
+ prepare:
+ name: Prepare Release
+ if: ${{ github.repository == 'apache/casbin-jcasbin' }}
+ runs-on: ubuntu-latest
+ outputs:
+ tag: ${{ steps.meta.outputs.tag }}
+ version: ${{ steps.meta.outputs.version }}
+ maven_version: ${{ steps.meta.outputs.maven_version }}
+ basename: ${{ steps.meta.outputs.basename }}
+ prerelease: ${{ steps.meta.outputs.prerelease }}
+ previous_tag: ${{ steps.meta.outputs.previous_tag }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Compute release metadata
+ id: meta
+ run: |
+ TAG_NAME="${GITHUB_REF_NAME}"
+
+ if [[ "${TAG_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
+ PRERELEASE=false
+ elif [[ "${TAG_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$ ]]; then
+ PRERELEASE=true
+ else
+ echo "Unsupported release tag: ${TAG_NAME}. Use v1.2.3 or v1.2.3-rc1." >&2
+ exit 1
+ fi
+
+ VERSION="${TAG_NAME#v}"
+ BASE_VERSION="${VERSION%%-rc*}"
+ BASENAME="apache-casbin-jcasbin-${VERSION}-incubating-src"
+ PREVIOUS_TAG="$(
+ {
+ git tag --list 'v*' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$'
+ echo "v${BASE_VERSION}"
+ } |
+ sort -V -u |
+ awk -v current="v${BASE_VERSION}" '
+ $0 == current {
+ print previous
+ exit
+ }
+ {
+ previous = $0
+ }
+ '
+ )"
+
+ echo "tag=${TAG_NAME}" >> "${GITHUB_OUTPUT}"
+ echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
+ echo "maven_version=${BASE_VERSION}" >> "${GITHUB_OUTPUT}"
+ echo "basename=${BASENAME}" >> "${GITHUB_OUTPUT}"
+ echo "prerelease=${PRERELEASE}" >> "${GITHUB_OUTPUT}"
+ echo "previous_tag=${PREVIOUS_TAG}" >> "${GITHUB_OUTPUT}"
+
+ echo "Tag: ${TAG_NAME} (pre-release: ${PRERELEASE})"
+ echo "Source package: ${BASENAME}.tar.gz"
+
+ github-release:
+ name: GitHub Release
+ needs: prepare
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Generate release notes
+ env:
+ CURRENT_TAG: ${{ needs.prepare.outputs.tag }}
+ CURRENT_VERSION: ${{ needs.prepare.outputs.version }}
+ PREVIOUS_TAG: ${{ needs.prepare.outputs.previous_tag }}
+ PRERELEASE: ${{ needs.prepare.outputs.prerelease }}
+ run: |
+ RELEASE_DATE="$(date -u +%F)"
+ RANGE="${CURRENT_TAG}"
+
+ if [ -n "${PREVIOUS_TAG}" ]; then
+ RANGE="${PREVIOUS_TAG}..${CURRENT_TAG}"
+ fi
+
+ FEATURES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(feat)(\(.+\))?: ' || true)"
+ FIXES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(fix)(\(.+\))?: ' || true)"
+ DOCS="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(docs?|doc)(\(.+\))?: ' || true)"
+
+ {
+ if [ -n "${PREVIOUS_TAG}" ]; then
+ echo "# [${CURRENT_VERSION}](https://github.com/${GITHUB_REPOSITORY}/compare/${PREVIOUS_TAG}...${CURRENT_TAG}) (${RELEASE_DATE})"
+ else
+ echo "# ${CURRENT_VERSION} (${RELEASE_DATE})"
+ fi
+ echo
+
+ if [ "${PRERELEASE}" = "true" ]; then
+ echo "Release candidate for the Apache voting process. This is not a released version."
+ echo
+ fi
+
+ if [ -n "${PREVIOUS_TAG}" ]; then
+ echo "Changes since ${PREVIOUS_TAG}."
+ echo
+ fi
+
+ if [ -n "${FEATURES}" ]; then
+ echo "## Features"
+ echo
+ printf '%s\n' "${FEATURES}" | sed 's/^/- /'
+ echo
+ fi
+
+ if [ -n "${FIXES}" ]; then
+ echo "## Fixes"
+ echo
+ printf '%s\n' "${FIXES}" | sed 's/^/- /'
+ echo
+ fi
+
+ if [ -n "${DOCS}" ]; then
+ echo "## Docs"
+ echo
+ printf '%s\n' "${DOCS}" | sed 's/^/- /'
+ echo
+ fi
+
+ if [ -z "${FEATURES}${FIXES}${DOCS}" ]; then
+ echo "## Notes"
+ echo
+ echo "- No feat/fix/doc commits were found in this release range."
+ fi
+ } > RELEASE_NOTES.md
+
+ - name: Create source packages
+ env:
+ TAG: ${{ needs.prepare.outputs.tag }}
+ BASENAME: ${{ needs.prepare.outputs.basename }}
+ run: |
+ mkdir -p dist
+ git archive --format=tar.gz --prefix="${BASENAME}/" -o "dist/${BASENAME}.tar.gz" "${TAG}"
+ git archive --format=zip --prefix="${BASENAME}/" -o "dist/${BASENAME}.zip" "${TAG}"
+ cd dist
+ sha512sum "${BASENAME}.tar.gz" > "${BASENAME}.tar.gz.sha512"
+ sha512sum "${BASENAME}.zip" > "${BASENAME}.zip.sha512"
+
+ - name: Create GitHub release
+ uses: softprops/action-gh-release@v2
+ with:
+ tag_name: ${{ needs.prepare.outputs.tag }}
+ name: JCasbin ${{ needs.prepare.outputs.tag }}
+ body_path: RELEASE_NOTES.md
+ draft: false
+ prerelease: ${{ needs.prepare.outputs.prerelease == 'true' }}
+ files: |
+ dist/${{ needs.prepare.outputs.basename }}.tar.gz
+ dist/${{ needs.prepare.outputs.basename }}.tar.gz.sha512
+ dist/${{ needs.prepare.outputs.basename }}.zip
+ dist/${{ needs.prepare.outputs.basename }}.zip.sha512
+
+ publish-maven:
+ name: Publish Maven
+ needs:
+ - prepare
+ - github-release
+ if: ${{ needs.prepare.outputs.prerelease == 'false' }}
+ uses: ./.github/workflows/maven-publish.yml
+ with:
+ maven_version: ${{ needs.prepare.outputs.maven_version }}
+ secrets: inherit
diff --git a/.github/workflows/source-release-draft.yml b/.github/workflows/source-release-draft.yml
deleted file mode 100644
index 8986105..0000000
--- a/.github/workflows/source-release-draft.yml
+++ /dev/null
@@ -1,125 +0,0 @@
-name: Build Source Release Draft
-
-on:
- push:
- tags:
- - "v*"
-
-permissions:
- contents: write
-
-jobs:
- build-source-release-draft:
- if: ${{ github.repository == 'apache/casbin-jcasbin' && !contains(github.ref_name, '-') }}
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
-
- - name: Compute release metadata
- id: release
- run: |
- TAG_NAME="${GITHUB_REF_NAME}"
- if ! [[ "${TAG_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
- echo "Unsupported release tag: ${TAG_NAME}" >&2
- exit 1
- fi
-
- VERSION="${TAG_NAME#v}"
- BASENAME="jcasbin-${VERSION}-src"
- PREVIOUS_TAG="$(
- git tag --list 'v*' |
- grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' |
- sort -V |
- awk -v current="${TAG_NAME}" '
- $0 == current {
- print previous
- exit
- }
- {
- previous = $0
- }
- '
- )"
-
- echo "tag=${TAG_NAME}" >> "${GITHUB_OUTPUT}"
- echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
- echo "basename=${BASENAME}" >> "${GITHUB_OUTPUT}"
- echo "previous_tag=${PREVIOUS_TAG}" >> "${GITHUB_OUTPUT}"
-
- - name: Generate release notes
- run: |
- CURRENT_TAG="${{ steps.release.outputs.tag }}"
- CURRENT_VERSION="${{ steps.release.outputs.version }}"
- PREVIOUS_TAG="${{ steps.release.outputs.previous_tag }}"
- RELEASE_DATE="$(date -u +%F)"
- RANGE="${CURRENT_TAG}"
-
- if [ -n "${PREVIOUS_TAG}" ]; then
- RANGE="${PREVIOUS_TAG}..${CURRENT_TAG}"
- fi
-
- FEATURES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(feat)(\(.+\))?: ' || true)"
- FIXES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(fix)(\(.+\))?: ' || true)"
- DOCS="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(docs?|doc)(\(.+\))?: ' || true)"
-
- {
- if [ -n "${PREVIOUS_TAG}" ]; then
- echo "# [${CURRENT_VERSION}](https://github.com/${GITHUB_REPOSITORY}/compare/${PREVIOUS_TAG}...${CURRENT_TAG}) (${RELEASE_DATE})"
- else
- echo "# ${CURRENT_VERSION} (${RELEASE_DATE})"
- fi
- echo
- echo "This GitHub release is a draft helper for packaging and release notes."
- echo
- if [ -n "${PREVIOUS_TAG}" ]; then
- echo "Changes since ${PREVIOUS_TAG}."
- fi
- echo
-
- if [ -n "${FEATURES}" ]; then
- echo "## Features"
- echo
- printf '%s\n' "${FEATURES}" | sed 's/^/- /'
- echo
- fi
-
- if [ -n "${FIXES}" ]; then
- echo "## Fixes"
- echo
- printf '%s\n' "${FIXES}" | sed 's/^/- /'
- echo
- fi
-
- if [ -n "${DOCS}" ]; then
- echo "## Docs"
- echo
- printf '%s\n' "${DOCS}" | sed 's/^/- /'
- echo
- fi
-
- if [ -z "${FEATURES}${FIXES}${DOCS}" ]; then
- echo "## Notes"
- echo
- echo "- No feat/fix/doc commits were found in this release range."
- fi
- } > RELEASE_NOTES.md
-
- - name: Create source archives
- run: |
- mkdir -p dist
- git archive --format=tar.gz --prefix="${{ steps.release.outputs.basename }}/" -o "dist/${{ steps.release.outputs.basename }}.tar.gz" "${{ steps.release.outputs.tag }}"
- git archive --format=zip --prefix="${{ steps.release.outputs.basename }}/" -o "dist/${{ steps.release.outputs.basename }}.zip" "${{ steps.release.outputs.tag }}"
-
- - name: Create draft GitHub release
- uses: softprops/action-gh-release@v2
- with:
- tag_name: ${{ steps.release.outputs.tag }}
- name: JCasbin ${{ steps.release.outputs.tag }}
- body_path: RELEASE_NOTES.md
- draft: true
- files: |
- dist/${{ steps.release.outputs.basename }}.tar.gz
- dist/${{ steps.release.outputs.basename }}.zip
diff --git a/.github/workflows/source-snapshot.yml b/.github/workflows/source-snapshot.yml
deleted file mode 100644
index f764f7f..0000000
--- a/.github/workflows/source-snapshot.yml
+++ /dev/null
@@ -1,113 +0,0 @@
-name: Semantic Release
-
-on:
- workflow_call:
- inputs:
- version:
- required: true
- type: string
- basename:
- required: true
- type: string
- previous_tag:
- required: false
- type: string
- default: ""
- workflow_dispatch:
- inputs:
- version:
- description: GitHub release tag, for example v1.2.3-snapshot.1
- required: true
- type: string
- basename:
- description: Source archive basename, for example jcasbin-1.2.3-snapshot.1-src
- required: true
- type: string
- previous_tag:
- description: Previous tag for release notes
- required: false
- type: string
-
-permissions:
- contents: write
-
-jobs:
- semantic-release:
- name: Semantic Release
- if: ${{ github.repository == 'apache/casbin-jcasbin' }}
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
-
- - name: Generate snapshot release notes
- run: |
- PREVIOUS_TAG="${{ inputs.previous_tag }}"
- CURRENT_TAG="${{ inputs.version }}"
- CURRENT_VERSION="${CURRENT_TAG#v}"
- RELEASE_DATE="$(date -u +%F)"
- RANGE="HEAD"
-
- if [ -n "${PREVIOUS_TAG}" ]; then
- RANGE="${PREVIOUS_TAG}..HEAD"
- fi
-
- FEATURES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(feat)(\(.+\))?: ' || true)"
- FIXES="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(fix)(\(.+\))?: ' || true)"
- DOCS="$(git log --pretty=format:'%s (%h)' "${RANGE}" | grep -Ei '^(docs?|doc)(\(.+\))?: ' || true)"
-
- {
- if [ -n "${PREVIOUS_TAG}" ]; then
- echo "# [${CURRENT_VERSION}](https://github.com/${GITHUB_REPOSITORY}/compare/${PREVIOUS_TAG}...${CURRENT_TAG}) (${RELEASE_DATE})"
- else
- echo "# ${CURRENT_VERSION} (${RELEASE_DATE})"
- fi
- echo
- if [ -n "${FEATURES}" ]; then
- echo "## Features"
- echo
- printf '%s\n' "${FEATURES}" | sed 's/^/- /'
- echo
- fi
-
- if [ -n "${FIXES}" ]; then
- echo "## Fixes"
- echo
- printf '%s\n' "${FIXES}" | sed 's/^/- /'
- echo
- fi
-
- if [ -n "${DOCS}" ]; then
- echo "## Docs"
- echo
- printf '%s\n' "${DOCS}" | sed 's/^/- /'
- echo
- fi
-
- if [ -z "${FEATURES}${FIXES}${DOCS}" ]; then
- echo "## Notes"
- echo
- echo "- No feat/fix/doc commits were found in this snapshot range."
- fi
- } > SNAPSHOT_RELEASE_NOTES.md
-
- - name: Create source archives
- run: |
- mkdir -p dist
- git archive --format=tar.gz --prefix="${{ inputs.basename }}/" -o "dist/${{ inputs.basename }}.tar.gz" HEAD
- git archive --format=zip --prefix="${{ inputs.basename }}/" -o "dist/${{ inputs.basename }}.zip" HEAD
-
- - name: Create Semantic release
- uses: softprops/action-gh-release@v2
- with:
- tag_name: ${{ inputs.version }}
- target_commitish: ${{ github.sha }}
- name: ${{ inputs.version }}
- body_path: SNAPSHOT_RELEASE_NOTES.md
- draft: false
- prerelease: false
- files: |
- dist/${{ inputs.basename }}.tar.gz
- dist/${{ inputs.basename }}.zip
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@casbin.apache.org
For additional commands, e-mail: commits-help@casbin.apache.org