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-python-async-postgres-watcher.git
The following commit(s) were added to refs/heads/master by this push:
new ea5c75d fix: release on tags only
ea5c75d is described below
commit ea5c75d3b6c31fc37c40811de0d338145be7860d
Author: Yang Luo <[email protected]>
AuthorDate: Tue Oct 20 22:39:53 2026 +0800
fix: release on tags only
---
.github/workflows/{release.yml => ci.yml} | 32 -----
.github/workflows/release.yml | 198 ++++++++++++------------------
.releaserc.json | 23 ----
README.md | 2 +-
package.json | 8 --
5 files changed, 82 insertions(+), 181 deletions(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/ci.yml
similarity index 77%
copy from .github/workflows/release.yml
copy to .github/workflows/ci.yml
index 22d3f0e..84be888 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/ci.yml
@@ -100,35 +100,3 @@ jobs:
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- release:
- name: Release
- runs-on: ubuntu-latest
- needs: [ tests, coveralls ]
- steps:
- - name: Checkout
- uses: actions/checkout@v2
- with:
- fetch-depth: 0
-
- - name: Setup Node.js
- uses: actions/setup-node@v1
- with:
- node-version: '20'
-
- - name: Setup
- run: npm install -g semantic-release @semantic-release/github
@semantic-release/changelog @semantic-release/commit-analyzer
@semantic-release/git @semantic-release/release-notes-generator
semantic-release-pypi
-
- - name: Set up python
- uses: actions/setup-python@v2
- with:
- python-version: 3.9
-
- - name: Install setuptools
- run: python -m pip install --upgrade setuptools wheel twine
-
- - name: Release
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
- run: npx semantic-release
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 22d3f0e..551e18c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,134 +1,98 @@
-name: tests
+name: release
+
+# Releases are triggered manually by pushing a git tag:
+# - v1.5.0-rc1 -> GitHub pre-release (the candidate used for the Apache
vote)
+# - v1.5.0 -> GitHub release + publish to PyPI
on:
push:
- branches: [master]
- pull_request:
- branches: [master]
-jobs:
- tests:
- runs-on: ${{ matrix.os }}
- strategy:
- fail-fast: false
- matrix:
- python-version: ["3.9", "3.10", "3.11", "3.12"]
- os: [ubuntu-latest, macOS-latest, windows-latest]
-
- steps:
- - name: Checkout
- uses: actions/checkout@v2
+ tags:
+ - "v*"
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v2
- with:
- python-version: ${{ matrix.python-version }}
-
- - name: Set up PostgreSQL on Linux
- if: startsWith(runner.os, 'linux')
- run: |
- sudo systemctl start postgresql.service
- pg_isready
- sudo -u postgres psql --command="ALTER USER postgres WITH PASSWORD
'123456'" --command="\du"
-
- - name: Setup PostgreSQL on macOS
- if: startsWith(runner.os, 'macos')
- run: |
- brew install postgresql@14
- brew services start postgresql@14
- echo "Check PostgreSQL service is running"
- i=10
- COMMAND='pg_isready'
- while [ $i -gt 0 ]; do
- echo "Check PostgreSQL service status"
- eval $COMMAND && break
- ((i--))
- if [ $i == 0 ]; then
- echo "PostgreSQL service not ready, all attempts exhausted"
- exit 1
- fi
- echo "PostgreSQL service not ready, wait 10 more sec, attempts
left: $i"
- sleep 10
- done
- psql --command="CREATE USER postgres PASSWORD '123456'"
--command="\du" postgres
+permissions:
+ contents: write
- - name: Start PostgreSQL on Windows
- if: startsWith(runner.os, 'windows')
- run: |
- $pgService = Get-Service -Name postgresql*
- Set-Service -InputObject $pgService -Status running -StartupType
automatic
- Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
- & $env:PGBIN\psql --command="ALTER USER postgres WITH PASSWORD
'123456'" --command="\du"
-
- - name: Upgrade install tools
- run: python -m pip install --upgrade setuptools wheel
-
- - name: Install dependencies
- run: |
- pip install -r requirements.txt
-
- - name: Run tests
- run: |
- python -m unittest discover -s tests -t tests
-
- coveralls:
+jobs:
+ release:
+ name: Release ${{ github.ref_name }}
+ if: github.repository == 'apache/casbin-python-async-postgres-watcher'
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
- name: Set up Python
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v5
with:
- python-version: 3.9
+ python-version: "3.12"
- - name: Install dependencies
+ - name: Resolve version from tag
+ id: version
run: |
- pip install -r requirements.txt
- pip install coveralls
- pip install coverage
-
- - name: Set up PostgreSQL on Linux
- if: startsWith(runner.os, 'linux')
- run: |
- sudo systemctl start postgresql.service
- pg_isready
- sudo -u postgres psql --command="ALTER USER postgres WITH PASSWORD
'123456'" --command="\du"
-
- - name: Run tests
- run: coverage run -m unittest discover -s tests -t tests
-
- - name: Upload coverage data to coveralls.io
- run: coveralls --service=github
+ set -euo pipefail
+ TAG="${GITHUB_REF_NAME}"
+ # v1.5.0-rc1 -> 1.5.0-rc1, v1.5.0 -> 1.5.0
+ VERSION="${TAG#v}"
+ if ! echo "$VERSION" | grep -Eq
'^[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$'; then
+ echo "::error::Tag $TAG is not vX.Y.Z or vX.Y.Z-rcN."
+ exit 1
+ fi
+ # The release candidate is voted on as the final version, so strip
"-rcN".
+ BASE_VERSION="${VERSION%%-rc*}"
+ if [ "$VERSION" != "$BASE_VERSION" ]; then
+ PRERELEASE=true
+ else
+ PRERELEASE=false
+ fi
+
+ # The source release must describe its own version, so pyproject.toml
+ # has to be bumped and committed before the tag is pushed.
+ PROJECT_VERSION="$(python -c "import tomllib;
print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")"
+ if [ "$PROJECT_VERSION" != "$BASE_VERSION" ]; then
+ echo "::error::tag $TAG expects version $BASE_VERSION in
pyproject.toml, found $PROJECT_VERSION"
+ exit 1
+ fi
+
+ echo "base_version=$BASE_VERSION" >> "$GITHUB_OUTPUT"
+ echo "prerelease=$PRERELEASE" >> "$GITHUB_OUTPUT"
+
+ - name: Build Apache source release
env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- release:
- name: Release
- runs-on: ubuntu-latest
- needs: [ tests, coveralls ]
- steps:
- - name: Checkout
- uses: actions/checkout@v2
- with:
- fetch-depth: 0
-
- - name: Setup Node.js
- uses: actions/setup-node@v1
- with:
- node-version: '20'
-
- - name: Setup
- run: npm install -g semantic-release @semantic-release/github
@semantic-release/changelog @semantic-release/commit-analyzer
@semantic-release/git @semantic-release/release-notes-generator
semantic-release-pypi
-
- - name: Set up python
- uses: actions/setup-python@v2
- with:
- python-version: 3.9
+ BASE_VERSION: ${{ steps.version.outputs.base_version }}
+ run: |
+ set -euo pipefail
+
NAME="apache-casbin-python-async-postgres-watcher-${BASE_VERSION}-incubating-src"
+ git archive --format=tar.gz --prefix="${NAME}/" -o "${NAME}.tar.gz"
HEAD
+ sha512sum "${NAME}.tar.gz" > "${NAME}.tar.gz.sha512"
- - name: Install setuptools
- run: python -m pip install --upgrade setuptools wheel twine
+ - name: Build Python distributions
+ if: steps.version.outputs.prerelease == 'false'
+ run: |
+ python -m pip install --upgrade build twine
+ python -m build
+ twine check dist/*
- - name: Release
+ - name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
- run: npx semantic-release
+ TAG: ${{ github.ref_name }}
+ PRERELEASE: ${{ steps.version.outputs.prerelease }}
+ run: |
+ set -euo pipefail
+ if [ "$PRERELEASE" = "true" ]; then
+ FLAGS="--prerelease"
+ else
+ FLAGS="--latest"
+ fi
+ gh release create "$TAG" \
+ --title "$TAG" \
+ --generate-notes \
+ $FLAGS \
+
apache-casbin-python-async-postgres-watcher-*-incubating-src.tar.gz \
+
apache-casbin-python-async-postgres-watcher-*-incubating-src.tar.gz.sha512
+
+ - name: Publish to PyPI
+ if: steps.version.outputs.prerelease == 'false'
+ env:
+ TWINE_USERNAME: __token__
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
+ run: twine upload dist/*
diff --git a/.releaserc.json b/.releaserc.json
deleted file mode 100644
index 94e24cd..0000000
--- a/.releaserc.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "branches": "master",
- "plugins": [
- "@semantic-release/commit-analyzer",
- "@semantic-release/release-notes-generator",
- "semantic-release-pypi",
- "@semantic-release/github",
- [
- "@semantic-release/changelog",
- {
- "changelogFile": "CHANGELOG.md",
- "changelogTitle": "# Semantic Versioning Changelog"
- }
- ],
- [
- "@semantic-release/git",
- {
- "message": "chore(release): ${nextRelease.version} [skip
ci]\n\n${nextRelease.notes}",
- "assets": ["CHANGELOG.md", "pyproject.toml"]
- }
- ]
- ]
-}
\ No newline at end of file
diff --git a/README.md b/README.md
index 71bd751..aa60cf8 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# async-postgres-watcher
-[](https://github.com/officialpycasbin/async-postgres-watcher/actions)
+[](https://github.com/apache/casbin-python-async-postgres-watcher/actions/workflows/ci.yml)
[](https://pypi.org/project/casbin-async-postgres-watcher/)
[](https://pypi.org/project/casbin-async-postgres-watcher/)
[](https://pypi.org/project/casbin-async-postgres-watcher/)
diff --git a/package.json b/package.json
deleted file mode 100644
index d533f02..0000000
--- a/package.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "devDependencies": {
- "@semantic-release/changelog": "^6.0.3",
- "@semantic-release/git": "^10.0.1",
- "semantic-release": "^22.0.5",
- "semantic-release-pypi": "^3.0.0"
- }
-}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]