Skip to content

Build(deps-dev): bump ty from 0.0.39 to 0.0.42 #324

Build(deps-dev): bump ty from 0.0.39 to 0.0.42

Build(deps-dev): bump ty from 0.0.39 to 0.0.42 #324

Workflow file for this run

name: Publish Package (PyPI)
on:
pull_request:
branches:
- main
jobs:
build_and_publish:
name: "Build and Publish PyPI package - TEST"
runs-on: ubuntu-latest
environment:
name: pypi
url: https://test.pypi.org/p/trtutils
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build toml
- name: Update version in pyproject.toml
run: |
python3 << END
import toml
import os
from datetime import datetime
# Read the current pyproject.toml
with open('pyproject.toml', 'r') as f:
config = toml.load(f)
# Get the current version
current_version = config['project']['version']
# Create a unique version using GitHub run number and current date
run_number = os.environ['GITHUB_RUN_NUMBER']
current_date = datetime.now().strftime("%Y%m%d")
new_version = f"{current_version}.dev{current_date}{run_number}"
# Update the version in the config
config['project']['version'] = new_version
# Write the updated config back to pyproject.toml
with open('pyproject.toml', 'w') as f:
toml.dump(config, f)
print(f"Updated version to {new_version}")
END
- name: Build trtutils
run: |
python -m build --sdist --wheel --outdir dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
verbose: true