diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml new file mode 100644 index 0000000..3369929 --- /dev/null +++ b/.github/workflows/dev-release.yml @@ -0,0 +1,51 @@ +name: Dev release + +on: + push: + branches-ignore: + - dependabot/** + - pre-commit-ci-update-config + - master + workflow_dispatch: + +env: + DEFAULT_PYTHON: '3.12' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + wait-code-analysis: + name: Dev release package + runs-on: ubuntu-latest + if: github.repository == 'MobileTeleSystems/horizon-hwm-store' # prevent running on forks + + environment: + name: test-pypi + url: https://test.pypi.org/p/horizon-hwm-store + permissions: + id-token: write # to auth in Test PyPI + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python ${{ env.DEFAULT_PYTHON }} + id: python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.DEFAULT_PYTHON }} + + - name: Upgrade pip + run: python -m pip install --upgrade pip setuptools wheel + + - name: Build package + run: python setup.py sdist bdist_wheel + + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ diff --git a/setup.py b/setup.py index 86489c3..2c0a1f0 100644 --- a/setup.py +++ b/setup.py @@ -11,20 +11,19 @@ def get_version(): - if "CI_COMMIT_TAG" in os.environ: - return os.environ["CI_COMMIT_TAG"] + if os.getenv("GITHUB_REF_TYPE", "branch") == "tag": + return os.environ["GITHUB_REF_NAME"] version_file = here / "horizon_hwm_store" / "VERSION" version = version_file.read_text().strip() # noqa: WPS410 - build_num = os.environ.get("CI_PIPELINE_IID", "") - branch_name = os.environ.get("CI_COMMIT_REF_SLUG", "") - branches_protect = ["master", "develop"] + build_num = os.environ.get("GITHUB_RUN_ID", "0") + branch_name = os.environ.get("GITHUB_REF_NAME", "") - if not branch_name or branch_name in branches_protect: - return f"{version}.dev{build_num}" + if not branch_name: + return version - return f"{version}.dev{build_num}+{branch_name}" + return f"{version}.dev{build_num}" def parse_requirements(file: Path) -> list[str]: @@ -48,7 +47,6 @@ def parse_requirements(file: Path) -> list[str]: url="https://github.com/MobileTeleSystems/horizon-hwm-store", classifiers=[ "Development Status :: 3 - Alpha", - "Intended Audience :: Data engineers", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", @@ -59,6 +57,7 @@ def parse_requirements(file: Path) -> list[str]: "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Software Development :: Libraries", "Typing :: Typed", ],