diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..61f11ba --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: Release + +on: [workflow_dispatch] + +jobs: + release: + runs-on: ubuntu-latest + concurrency: release + permissions: + id-token: write + contents: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Python Semantic Release + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Install dependencies + run: | + pip install -e .[dev] + + - name: Run Semantic Release + run: make release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index 367b3fa..b2b75b3 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,17 @@ format: ## Format code automatically isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes. isort --skip=templates ${SRC_DIRS} +release: ## release a new version + @echo "Releasing a new version." + @echo "This is a remote release, it will push to the remote repository." + semantic-release -vv version --changelog --push --tag --commit + +local-release: + @echo "Releasing a new version." + @echo "This is a local release, it will not push to the remote repository." + @echo "You can push the changes and release manually." + semantic-release -vv version --changelog --commit --no-push + ESCAPE =  help: ## Print this help @grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f6cedcd --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,73 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "tutor-contrib-celery" +dynamic = ["version"] +description = "A Tutor plugin to manage our opinionated Open edX operations" +readme = "README.md" +requires-python = ">=3.8" +license = { text = "AGPLv3" } +authors = [ + { name = "eduNEXT" } +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU Affero General Public License v3", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] +dependencies = [ + "tutor>=18.0.0,<19.0.0" +] + +optional-dependencies = { dev = ["python-semantic-release", "pylint", "black"]} + +[project.urls] +Homepage = "https://github.com/edunext/tutor-contrib-celery" +Code = "https://github.com/edunext/tutor-contrib-celery" +"Issue tracker" = "https://github.com/edunext/tutor-contrib-celery/issues" + +[tool.setuptools.packages.find] +where = ["."] +exclude = ["tests*"] + +[project.entry-points."tutor.plugin.v1"] +celery = "tutorcelery.plugin" + +[tool.setuptools.dynamic] +version = {attr = "tutorcelery.__about__.__version__"} + +[tool.wheel] +universal = true + +[tool.semantic_release] +commit_message = "chore(release): preparing {version}" +version_variables = [ + "tutorcelery/__about__.py:__version__", +] + +[tool.semantic_release.branches.main] +match = "(main|master)" +prerelease_token = "rc" +prerelease = false + +[tool.semantic_release.changelog.environment] +keep_trailing_newline = true + +[tool.semantic_release.changelog] +exclude_commit_patterns = [ + "docs:", + "build:", + "style:", + "chore:", + "test:", + "ci:", +] diff --git a/setup.py b/setup.py deleted file mode 100644 index d0226fb..0000000 --- a/setup.py +++ /dev/null @@ -1,68 +0,0 @@ -import io -import os - -from setuptools import find_packages, setup - -HERE = os.path.abspath(os.path.dirname(__file__)) - - -def load_readme(): - with io.open(os.path.join(HERE, "README.md"), "rt", encoding="utf8") as f: - return f.read() - - -def load_about(): - about = {} - with io.open( - os.path.join(HERE, "tutorcelery", "__about__.py"), - "rt", - encoding="utf-8", - ) as f: - exec(f.read(), about) # pylint: disable=exec-used - return about - - -ABOUT = load_about() - - -setup( - name="tutor-contrib-celery", - version=ABOUT["__version__"], - url="https://github.com/eduNEXT/tutor-contrib-celery", - project_urls={ - "Code": "https://github.com/eduNEXT/tutor-contrib-celery", - "Issue tracker": "https://github.com/eduNEXT/tutor-contrib-celery/issues", - }, - license="AGPLv3", - author="edunext", - author_email="technical@edunext.co", - description="celery plugin for Tutor", - long_description=load_readme(), - long_description_content_type="text/x-rst", - packages=find_packages(exclude=["tests*"]), - include_package_data=True, - python_requires=">=3.7", - install_requires=["tutor>=18.0.0,<19.0.0"], - extras_require={ - "dev": [ - "tutor[dev]>=18.0.0,<19.0.0", - ] - }, - entry_points={ - "tutor.plugin.v1": [ - "celery = tutorcelery.plugin" - ] - }, - classifiers=[ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "License :: OSI Approved :: GNU Affero General Public License v3", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - ], -)