From d6c4bd7031a818d251a1ce89c820851c405af4ab Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Sun, 21 Jan 2024 06:40:05 +0000 Subject: [PATCH] Add workflow to release mlgo utils --- .github/workflows/publish-mlgo-utils.yml | 40 ++++++++++++++++++++++++ llvm/utils/mlgo-utils/mlgo/__init__.py | 8 ++++- llvm/utils/mlgo-utils/pyproject.toml | 2 +- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish-mlgo-utils.yml diff --git a/.github/workflows/publish-mlgo-utils.yml b/.github/workflows/publish-mlgo-utils.yml new file mode 100644 index 0000000000000..43e0589c637a1 --- /dev/null +++ b/.github/workflows/publish-mlgo-utils.yml @@ -0,0 +1,40 @@ +name: Release mlgo-utils + +permissions: + contents: read + +on: + workflow_dispatch: + inputs: + branch: + description: 'Branch' + required: true + type: string + +jobs: + release-mlgo-utils: + name: Release mlgo-utils + runs-on: ubuntu-latest + steps: + - name: Checkout LLVM + uses: actions/checkout@v4.1.1 + with: + ref: "${{ inputs.branch }}" + - name: Install dependencies + run: | + pip3 install build==0.10.0 setuptools==68.0.00 + - name: Package mlgo-utils + run: | + cd llvm/utils/mlgo-utils + python3 -m build + - name: Upload mlgo-utils to test.pypi.org + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.MLGO_UTILS_TEST_PYPI_API_TOKEN }} + repository-url: https://test.pypi.org/legacy/ + packages-dir: llvm/utils/mlgo-utils/dist/ + - name: Upload mlgo-utils to pypi.org + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.MLGO_UTILS_PYPI_API_TOKEN }} + packages-dir: llvm/utils/mlgo-utils/dist/ diff --git a/llvm/utils/mlgo-utils/mlgo/__init__.py b/llvm/utils/mlgo-utils/mlgo/__init__.py index bcb5de2ff4d57..917b6bc4c14b1 100644 --- a/llvm/utils/mlgo-utils/mlgo/__init__.py +++ b/llvm/utils/mlgo-utils/mlgo/__init__.py @@ -2,5 +2,11 @@ # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +from datetime import timezone, datetime + __versioninfo__ = (18, 0, 0) -__version__ = ".".join(str(v) for v in __versioninfo__) + "dev" +__version__ = ( + ".".join(str(v) for v in __versioninfo__) + + "dev" + + datetime.now(tz=timezone.utc).strftime("%Y%m%d%H%M") +) diff --git a/llvm/utils/mlgo-utils/pyproject.toml b/llvm/utils/mlgo-utils/pyproject.toml index be2af86cd05df..abd243fd4fb4e 100644 --- a/llvm/utils/mlgo-utils/pyproject.toml +++ b/llvm/utils/mlgo-utils/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" [project] -name = "mlgo" +name = "mlgo-utils" description = "Tooling for ML in LLVM" readme = "README.md" requires-python = ">=3.8,<3.11"