Skip to content

Commit

Permalink
CI: add testpypi.yml
Browse files Browse the repository at this point in the history
Dev releases would be published to
https://test.pypi.org/project/ceph-nvmeof/
on every merge to "devel" branch.

Package will override if the version already exists.
For example, if "1.2.15" already exists on test.pypi
and the new commit also has same version (in pyproject.toml),
then that package would be overwritten (by using a bigger
build number).

Signed-off-by: Vallari Agrawal <[email protected]>
  • Loading branch information
VallariAg committed Jul 11, 2024
1 parent 83ec9bd commit 3f3a32f
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/testpypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Publish python package at https://test.pypi.org/p/ceph-nvmeof
# This is for dev releases, and will be pushed to test pypi on all merges to "devel" branch.
# Usage: `pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple ceph-nvmeof==1.2.15`
name: Upload release to Test PyPI
on:
push:
tags:
- '*'
branches:
- 'devel'

jobs:
pypi-publish:
name: Upload release to Test PyPI
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/ceph-nvmeof
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: pdm-project/setup-pdm@v3
with:
python-version: 3.9
version: "2.7.4"
- name: Sync Dependencies
run: pdm sync -v --no-isolation --no-self --no-editable
- name: Compile Protocol Buffers
run: pdm run protoc
- name: Set current date as env variable
run: echo "NOW=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
# - name: [debug] Set dev version number # Helpful to debug during CI fails
# run: |
# NEW_VERSION="$(pdm show --version).dev$NOW"
# sed -i "s/^version = \".*\"/version = \"${NEW_VERSION}\"/" pyproject.toml
- name: Build package
run: pdm build --config-setting="--build-number=$NOW" --no-sdist
- name: Publish package distributions to Test PyPI
run: pdm publish --no-build -r testpypi

0 comments on commit 3f3a32f

Please sign in to comment.