From f1c0c03df3f8883280ee0ea58190f47c2ea23032 Mon Sep 17 00:00:00 2001 From: Ziyang Dong Date: Wed, 5 Aug 2026 15:48:28 +0800 Subject: [PATCH] ci: replace semantic-release with tag-triggered manual release --- .github/workflows/ci.yml | 15 ------ .github/workflows/release.yml | 95 +++++++++++++++++++++++++++++++++++ .releaserc.json | 16 ------ DISCLAIMER | 5 ++ NOTICE | 8 +++ 5 files changed, 108 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 .releaserc.json create mode 100644 DISCLAIMER create mode 100644 NOTICE diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3644c19..b9dfe60 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,18 +33,3 @@ jobs: - uses: shogo82148/actions-goveralls@v1 with: path-to-profile: ./profile.cov - - semantic-release: - needs: [test] - runs-on: ubuntu-latest - steps: - - - uses: actions/checkout@v2 - - - name: Run semantic-release - if: github.repository == 'casbin/mongodb-adapter' && 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..fc33d44 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,95 @@ +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 (the Go module is published automatically by +# proxy.golang.org once the tag exists) +# +# The release manager downloads the source package from the release, signs it +# locally with their own GPG key, and uses it for the vote. This workflow does +# not sign anything and does not touch any other Apache infrastructure. + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + release: + if: ${{ github.repository == 'apache/casbin-mongodb-adapter' }} + runs-on: ubuntu-latest + 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}" + BASENAME="casbin-mongodb-adapter-${VERSION}-incubating-src" + + { + echo "tag=${TAG_NAME}" + echo "version=${VERSION}" + echo "basename=${BASENAME}" + echo "prerelease=${PRERELEASE}" + } >> "${GITHUB_OUTPUT}" + + - name: Build source release tarball + env: + BASENAME: ${{ steps.meta.outputs.basename }} + TAG: ${{ steps.meta.outputs.tag }} + run: | + set -euo pipefail + mkdir -p dist + git archive --format=tar.gz --prefix="${BASENAME}/" -o "dist/${BASENAME}.tar.gz" "${TAG}" + cd dist + sha512sum "${BASENAME}.tar.gz" > "${BASENAME}.tar.gz.sha512" + sha512sum -c "${BASENAME}.tar.gz.sha512" + ls -l + + - name: Write release notes + env: + VERSION: ${{ steps.meta.outputs.version }} + PRERELEASE: ${{ steps.meta.outputs.prerelease }} + BASENAME: ${{ steps.meta.outputs.basename }} + run: | + if [[ "${PRERELEASE}" == "true" ]]; then + printf 'Release candidate for version `%s`. This is **not** a released version; it is the source artifact for the Apache release vote.\n' "${VERSION%%-rc*}" + else + printf 'Version `%s`.\n' "${VERSION}" + fi + printf '\n| Asset | Description |\n| --- | --- |\n' + printf '| `%s.tar.gz` | Source release |\n' "${BASENAME}" + printf '| `%s.tar.gz.sha512` | SHA-512 checksum |\n\n' "${BASENAME}" + printf 'The release manager signs the tarball locally with their own GPG key before starting the vote.\n' + # shellcheck: the script above deliberately keeps release notes minimal + # (per the project's policy: no extra Apache processes in CI). + + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.meta.outputs.tag }} + name: Casbin MongoDB Adapter ${{ steps.meta.outputs.tag }} + body_path: release-notes.md + draft: false + prerelease: ${{ steps.meta.outputs.prerelease == 'true' }} + files: | + dist/${{ steps.meta.outputs.basename }}.tar.gz + dist/${{ steps.meta.outputs.basename }}.tar.gz.sha512 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/DISCLAIMER b/DISCLAIMER new file mode 100644 index 0000000..1ef6eb0 --- /dev/null +++ b/DISCLAIMER @@ -0,0 +1,5 @@ +Apache Casbin (Incubating) is an effort undergoing incubation at the Apache Software Foundation (ASF), sponsored by the Apache Incubator PMC. + +Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..dfa082b --- /dev/null +++ b/NOTICE @@ -0,0 +1,8 @@ +Apache Casbin (Incubating) +Copyright 2026 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (https://www.apache.org/). + +Portions of this software were originally developed by the Casbin project. +Copyright 2017-2026 The casbin Authors.