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-gateway.git
commit 6f2a12ac30f50713014568eb4903939528f353bd Author: Ziyang Dong <[email protected]> AuthorDate: Mon Aug 10 21:21:02 2026 +0800 ci: replace semantic-release with manual tag-triggered release (#180) --- .github/workflows/build.yml | 68 --------------------------- .github/workflows/release.yml | 107 ++++++++++++++++++++++++++++++++++++++++++ .releaserc.json | 23 --------- 3 files changed, 107 insertions(+), 91 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 53a1562..45530c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,71 +62,3 @@ jobs: run: | go build -race -ldflags "-extldflags '-static'" working-directory: ./ - - release-and-push: - name: Release And Push - runs-on: ubuntu-latest - if: github.repository == 'casbin/caswaf' && github.event_name == 'push' && github.ref == 'refs/heads/master' - needs: [ frontend, backend] - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: -1 - - - name: Create Tag with Semantic Release - id: semantic - uses: cycjimmy/semantic-release-action@v4 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Decide Should_Push Or Not - id: should_push - run: | - old_version=${{ steps.semantic.outputs.last_release_version }} - new_version=${{ steps.semantic.outputs.new_release_version }} - - # If semantic-release didn't create a new version, skip Docker push - if [ -z "$new_version" ]; then - echo ::set-output name=push::'false' - exit 0 - fi - - 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/caswaf' && github.event_name == 'push' && github.ref == 'refs/heads/master' && 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/caswaf' && github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.should_push.outputs.push=='true' - with: - context: . - target: STANDARD - platforms: linux/amd64 - push: true - tags: casbin/caswaf:${{ steps.semantic.outputs.new_release_version }},casbin/caswaf: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..dcfbcf4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,107 @@ +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-gateway' }} + 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="apache-casbin-gateway-${VERSION%-rc*}-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: | + set -euo pipefail + { + 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' + } > release-notes.md + cat release-notes.md + + # The gh CLI is used instead of a marketplace action: the ASF org only + # allows actions owned by GitHub or by the enterprise allow-list. + - name: Create GitHub release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ steps.meta.outputs.tag }} + BASENAME: ${{ steps.meta.outputs.basename }} + PRERELEASE: ${{ steps.meta.outputs.prerelease }} + run: | + set -euo pipefail + args=( + "${TAG}" + --title "Casbin Gateway ${TAG}" + --notes-file release-notes.md + ) + if [[ "${PRERELEASE}" == "true" ]]; then + args+=(--prerelease) + fi + gh release create "${args[@]}" \ + "dist/${BASENAME}.tar.gz" \ + "dist/${BASENAME}.tar.gz.sha512" diff --git a/.releaserc.json b/.releaserc.json deleted file mode 100644 index e38e740..0000000 --- a/.releaserc.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "debug": true, - "branches": [ - "+([0-9])?(.{+([0-9]),x}).x", - "master", - { - "name": "rc" - }, - { - "name": "beta", - "prerelease": true - }, - { - "name": "alpha", - "prerelease": true - } - ], - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/github" - ] -} \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
