From 48e95e4e2d0b27b38da211a8f7c5333fc88b89f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= <16805946+edgarrmondragon@users.noreply.github.com> Date: Tue, 6 Feb 2024 08:33:17 -0600 Subject: [PATCH] ci: Use `hynek/build-and-inspect-python-package` (#205) --- .github/workflows/release.yml | 38 +++++++++++++++++------------------ pyproject.toml | 4 ++-- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7364f6e..fef3f12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,37 +1,34 @@ -name: Build & Release +name: Release on: - release: - types: [published] # Trigger only when a release is published, not when a release is drafted + push: permissions: contents: write # Needed to upload artifacts to the release id-token: write # Needed for OIDC PyPI publishing jobs: - build_and_release: - + build: runs-on: ubuntu-latest - environment: publishing - steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v5 + - uses: hynek/build-and-inspect-python-package@v2 + + publish: + name: Publish to PyPI + runs-on: ubuntu-latest + needs: [build] + environment: + name: publishing + url: https://pypi.org/p/meltano-edk + if: startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/download-artifact@v4 with: - python-version: '3.10' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install poetry - - name: Build package - run: | - poetry self add "poetry-dynamic-versioning[plugin]" - poetry config repositories.testpypi https://test.pypi.org/legacy/ - poetry dynamic-versioning --no-cache - poetry build + name: Packages + path: dist - name: Upload wheel to release uses: svenstaro/upload-release-action@v2 with: @@ -40,5 +37,6 @@ jobs: tag: ${{ github.ref }} overwrite: true file_glob: true + - name: Publish uses: pypa/gh-action-pypi-publish@v1.8.11 diff --git a/pyproject.toml b/pyproject.toml index 5e928e7..9972d37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -103,8 +103,8 @@ convention = "google" [build-system] requires = [ - "poetry-core==1.5.0", - "poetry-dynamic-versioning==0.21.3", + "poetry-core==1.9", + "poetry-dynamic-versioning==1.2", ] build-backend = "poetry_dynamic_versioning.backend"