From ffc7a50035e9d28ff386974ea5cafb46c868137a Mon Sep 17 00:00:00 2001 From: Duan Juanyong Date: Fri, 31 May 2024 20:32:22 +0800 Subject: [PATCH] change version --- .github/workflows/cd.yml | 89 +++++++++++++--------------------------- pyproject.toml | 2 +- 2 files changed, 30 insertions(+), 61 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 5a1229e..a54bbae 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -8,100 +8,69 @@ on: - '*' jobs: - build-on-windows: + build: name: Build distribution 📦 runs-on: windows-latest + strategy: + matrix: + python-version: + ['3.9', '3.10', '3.11', '3.12'] + steps: - uses: actions/checkout@v4 - - name: Set up Python + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: - python-version: "3.x" + python-version: ${{ matrix.python-version }} - name: Install pypa/build run: | python -m pip install --upgrade pip pip install setuptools wheel twine build - name: Build a binary wheel and a source tarball run: python3 -m build - - name: Rename the distribution files - run: | - # Get all .whl files in the dist folder - $files = Get-ChildItem -Path .\dist\ -Filter *.whl - - # Loop through each file - foreach ($file in $files) { - # Split the file name by "-" - $nameParts = $file.BaseName -split "-" - - # Replace the third and fourth items by "py3" - $nameParts[2] = "py3" - $nameParts[3] = "py3" - - # Assemble the new file name with new items - $newName = [string]::Join("-", $nameParts) + ".whl" - - # Move the old file to new file name - Move-Item -Path $file.FullName -Destination .\dist\$newName - } - - name: Store the distribution packages uses: actions/upload-artifact@v3 with: name: python-package-distributions path: dist/ - build-on-linux: - name: Build distribution 📦 + publish-to-testpypi: + name: Publish Python 🐍 distribution 📦 to TestPyPI + needs: + - build runs-on: ubuntu-latest + environment: + name: release + url: https://test.pypi.org/p/time-series-anomaly-detector + + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 with: - python-version: "3.x" - - name: Install pypa/build - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine build - - name: Build a binary wheel and a source tarball - run: python3 -m build --wheel - - name: Rename the distribution files - run: | - # Navigate to the dist directory - cd dist - - # Loop over every .whl file - for oldname in *.whl - do - # Split the filename by "-" - IFS='-' read -ra nameParts <<< "$oldname" - - # Replace the third and fourth items by "py3" - nameParts[2]="py3" - nameParts[3]="py3" - nameParts[4]="manylinux1.whl" - - # Assemble the new filename - newName=$(IFS='-'; echo "${nameParts[*]}") - - # Move the old file to the new filename - mv "$oldname" "$newName" - done + repository-url: https://test.pypi.org/legacy/ - name: Store the distribution packages uses: actions/upload-artifact@v3 with: name: python-package-distributions path: dist/ + github-release: name: >- Sign the Python 🐍 distribution 📦 with Sigstore and upload them to GitHub Release needs: - - build-on-windows - - build-on-linux + - publish-to-testpypi runs-on: ubuntu-latest permissions: diff --git a/pyproject.toml b/pyproject.toml index a8acd3e..8bb0101 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "time-series-anomaly-detector" -version = "0.2.5" +version = "0.2.5b" description = "Time Series Anomaly Detector" readme = "README.md" requires-python = ">=3.9.0"