ci: refine publishing WF (#202)

* ci: update CI workflow to use `buildwheel` action.

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>

* docs: Add pipeline change to the changelog

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>

* chore: temporary add ability to build on PRs.

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>

* [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 <savik.ne@gmail.com>

* docs: Update changelog

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>

* ci: don't build on PRs

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>

* ci: don't fetch repo history on publish

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>

Signed-off-by: Yurii Serhiichuk <savik.ne@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Yurii Serhiichuk 2022-11-21 16:20:09 +02:00 committed by GitHub
parent cf5616be42
commit 81f07b6d9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 4 deletions

View File

@ -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

View File

@ -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