diff --git a/.github/workflows/py.yml b/.github/workflows/py.yml index 075e335..fa2b0fc 100644 --- a/.github/workflows/py.yml +++ b/.github/workflows/py.yml @@ -36,3 +36,27 @@ jobs: run: rye run check - name: Test run: rye run test + + publish: + needs: test + environment: release + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + + - name: Setup python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Build + run: | + pip install build + python -m build + + - name: Publish + # mimics: twine upload dist/* --skip-existing + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 19f1e9e..527baad 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,3 +22,24 @@ jobs: run: cargo clippy - name: Test run: cargo test --all-features + + publish: + needs: test + environment: release + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/checkout@v4 + - name: set version + env: + RELEASE_TAG: ${{ github.ref }} + run: | + sed -i "s/0\\.0\\.999/${RELEASE_TAG##*\/v}/" upid_rs/Cargo.toml + sed -i "s/0\\.0\\.999/${RELEASE_TAG##*\/v}/" Cargo.lock + + - uses: dtolnay/rust-toolchain@stable + - name: publish + env: + CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} + run: | + cargo publish --package upid --token $CRATES_TOKEN --allow-dirty diff --git a/Cargo.lock b/Cargo.lock index 352f350..61c0c51 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -63,7 +63,7 @@ dependencies = [ [[package]] name = "upid" -version = "0.1.0" +version = "0.0.999" dependencies = [ "rand", ] diff --git a/pyproject.toml b/pyproject.toml index 20826ca..64e3cf3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,14 +7,31 @@ all = { chain = ["fmt", "lint", "check", "test"] } [project] name = "upid" -version = "0.1.0" description = "Universally Unique Prefixed Lexicographically Sortable Identifier" authors = [ { name = "Chris Arderne", email = "chris@rdrn.me" } ] -dependencies = [] readme = "README.md" +license = {text = "MIT License"} requires-python = ">= 3.9" +keywords = ["UUID", "id", "database"] + +dynamic = ["version"] + +classifiers = [ + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: Unix", + "Programming Language :: Python", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Software Development :: Libraries", +] + +dependencies = [] [build-system] requires = ["pdm-backend"] @@ -23,6 +40,9 @@ build-backend = "pdm.backend" [tool.pdm.build] package-dir = "py" +[tool.pdm.version] +source = "scm" + [tool.rye] managed = true dev-dependencies = [ diff --git a/upid_rs/Cargo.toml b/upid_rs/Cargo.toml index 534c464..6dda657 100644 --- a/upid_rs/Cargo.toml +++ b/upid_rs/Cargo.toml @@ -6,7 +6,7 @@ description = "Universally Unique Prefixed Lexicographically Sortable Identifier readme = "../README.md" repository = "https://github.com/carderne/upid" -version = "0.1.0" +version = "0.0.999" # set by Github Actions CI edition = "2021"