From 81f07b6d9f747ef83e0ad1856adffb2e0b972470 Mon Sep 17 00:00:00 2001 From: Yurii Serhiichuk Date: Mon, 21 Nov 2022 16:20:09 +0200 Subject: [PATCH] ci: refine publishing WF (#202) * ci: update CI workflow to use `buildwheel` action. Signed-off-by: Yurii Serhiichuk * docs: Add pipeline change to the changelog Signed-off-by: Yurii Serhiichuk * chore: temporary add ability to build on PRs. Signed-off-by: Yurii Serhiichuk * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * ci: Do not try using cibuildwheels Signed-off-by: Yurii Serhiichuk * docs: Update changelog Signed-off-by: Yurii Serhiichuk * ci: don't build on PRs Signed-off-by: Yurii Serhiichuk * ci: don't fetch repo history on publish Signed-off-by: Yurii Serhiichuk Signed-off-by: Yurii Serhiichuk Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/pypi-release.yml | 35 ++++++++++++++++++++++++++---- CHANGELOG.md | 3 +++ 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml index 8a2bc61..d3165dc 100644 --- a/.github/workflows/pypi-release.yml +++ b/.github/workflows/pypi-release.yml @@ -1,15 +1,37 @@ name: PyPI-Release on: + workflow_dispatch: push: branches: - main jobs: - build-and-publish: - runs-on: ubuntu-latest + build_dist: + name: Build source distribution + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Build SDist and wheel + run: pipx run build + + - uses: actions/upload-artifact@v3 + with: + path: dist/* + + - name: Check metadata + run: pipx run twine check dist/* + publish: + runs-on: ubuntu-22.04 + if: github.event_name == 'push' + needs: [ build_dist ] + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v4 with: @@ -17,11 +39,16 @@ jobs: cache: 'pip' - name: Install build dependencies run: pip install -U setuptools wheel build - - name: Build - run: python -m build . + - uses: actions/download-artifact@v3 + with: + # unpacks default artifact into dist/ + # if `name: artifact` is omitted, the action will create extra parent dir + name: artifact + path: dist - name: Publish uses: pypa/gh-action-pypi-publish@release/v1 with: + user: __token__ password: ${{ secrets.pypi_password }} - name: Install GitPython and cloudevents for pypi_packaging run: pip install -U -r requirements/publish.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 15eab2d..d5bc2de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Refined build and publishing process. Added SDist to the released package ([#202]) ## [1.7.0] — 2022-11-17 ### Added @@ -225,3 +227,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#191]: https://github.com/cloudevents/sdk-python/pull/191 [#195]: https://github.com/cloudevents/sdk-python/pull/195 [#197]: https://github.com/cloudevents/sdk-python/pull/197 +[#202]: https://github.com/cloudevents/sdk-python/pull/202