From 68a9b16149ef1ae1a1a432e727271be74ef44557 Mon Sep 17 00:00:00 2001 From: julio Almeida Date: Wed, 20 Nov 2024 16:44:43 +0100 Subject: [PATCH] new workflows --- .github/workflows/manual-publish.yml | 38 ++++++++++++++++++++++++++++ .github/workflows/workflow.yml | 23 ----------------- 2 files changed, 38 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/manual-publish.yml diff --git a/.github/workflows/manual-publish.yml b/.github/workflows/manual-publish.yml new file mode 100644 index 0000000..73fbeae --- /dev/null +++ b/.github/workflows/manual-publish.yml @@ -0,0 +1,38 @@ +name: Manual PyPI Publish + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to publish (optional)' + required: false + type: string + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.9' + + - name: Install dependencies + run: | + pip install poetry + poetry install + + - name: Update version if provided + if: inputs.version != '' + run: poetry version ${{ inputs.version }} + + - name: Build package + run: poetry build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@v1.4.2 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 0f196ff..d19b5fe 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -31,29 +31,6 @@ jobs: - name: Build package run: poetry build - - name: Check version change - id: check_version - run: | - git fetch origin main - # Extract version from current pyproject.toml - current_version=$(poetry version -s) - # Extract version from main branch pyproject.toml - main_version=$(git show origin/main:pyproject.toml | grep "^version = " | cut -d'"' -f2) - if [ "$current_version" != "$main_version" ]; then - echo "Version changed from $main_version to $current_version" - echo "version_changed=true" >> $GITHUB_OUTPUT - else - echo "Version unchanged" - echo "version_changed=false" >> $GITHUB_OUTPUT - fi - - - name: Publish to PyPI - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.check_version.outputs.version_changed == 'true' - uses: pypa/gh-action-pypi-publish@v1.4.2 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} - test-python-versions: name: Test Python ${{ matrix.python-version }} runs-on: ubuntu-latest