From ab368ecea93b5133a41937bd87aa7ef1eaef69d6 Mon Sep 17 00:00:00 2001 From: guillemdb Date: Tue, 3 Sep 2024 12:06:13 +0200 Subject: [PATCH] Add relase package action Signed-off-by: guillemdb --- .github/workflows/push.yml | 69 +++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index e4df232..0e238c3 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -263,34 +263,41 @@ jobs: login: "${{ env.bot_name }}" token: "${{ secrets.BOT_AUTH_TOKEN }}" -# release-package: -# name: Release PyPI package -# env: -# PYPI_PASS: ${{ secrets.PYPI_PASS }} -# if: "contains(github.event.head_commit.message, 'Bump version') && github.ref == 'refs/heads/master' && '$PYPI_PASS' != ''" -# runs-on: ubuntu-20.04 -# steps: -# - name: actions/checkout -# uses: actions/checkout@v3 -# - name: Set up Python 3.8 -# uses: actions/setup-python@v3 -# with: -# python-version: 3.8 -# - name: Install dependencies -# run: | -# set -x -# python -m pip install -U pip -# python -m pip install -U setuptools twine wheel -# -# - name: Build package -# run: | -# set -x -# python setup.py --version -# python setup.py bdist_wheel sdist --format=gztar -# twine check dist/* -# -# - name: Publish package to PyPI -# uses: pypa/gh-action-pypi-publish@master -# with: -# user: __token__ -# password: ${{ secrets.PYPI_PASS }} + release-package: + name: Release PyPI package + env: + PYPI_PASS: ${{ secrets.PYPI_PASS }} + if: "contains(github.event.head_commit.message, 'Bump version') && github.ref == 'refs/heads/master' && '$PYPI_PASS' != ''" + runs-on: ubuntu-latest + steps: + - name: actions/checkout + uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Setup Rye + id: setup-rye + uses: eifinger/setup-rye@v4 + with: + enable-cache: true + cache-prefix: ubuntu-latest-rye-release-3.10-${{ hashFiles('pyproject.toml') }} + - name: Install dependencies + run: | + set -x + rye install twine + + - name: Build package + run: | + set -x + rye build --clean + twine check dist/* + + - name: Publish package to PyPI + env: + PYPI_PASS: ${{ secrets.PYPI_PASS }} + if: "'$PYPI_PASS' != ''" + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_PASS }} + skip-existing: true