diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a0e357cc0..d8e78c98a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -30,28 +30,21 @@ jobs: run: nox -vs build - name: Read the Changelog id: read-changelog - uses: mindsers/changelog-reader-action@v1 + uses: mindsers/changelog-reader-action@v2 with: version: ${{ steps.build.outputs.version }} - - name: Create GitHub release + - name: Create GitHub release and upload the distribution id: create-release - uses: actions/create-release@v1 + uses: softprops/action-gh-release@v1 with: - tag_name: ${{ github.ref }} - release_name: ${{ steps.build.outputs.version }} - body: ${{ steps.read-changelog.outputs.log_entry }} - draft: false + name: ${{ steps.build.outputs.version }} + body: ${{ steps.read-changelog.outputs.changes }} + draft: ${{ env.ACTIONS_STEP_DEBUG == 'true' }} prerelease: false - - name: Upload the distribution to GitHub - uses: actions/upload-release-asset@v1 - with: - upload_url: ${{ steps.create-release.outputs.upload_url }} - asset_path: ${{ steps.build.outputs.asset_path }} - asset_name: ${{ steps.build.outputs.asset_name }} - asset_content_type: application/gzip + files: ${{ steps.build.outputs.asset_path }} - name: Upload the distribution to PyPI if: ${{ env.B2_PYPI_PASSWORD != '' }} - uses: pypa/gh-action-pypi-publish@v1.3.1 + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ env.B2_PYPI_PASSWORD }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 26f0f9b66..4c338cc86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Infrastructure * Remove dependency from `arrow` +* Build Python wheels for distribution ## [1.20.0] - 2023-03-23 diff --git a/noxfile.py b/noxfile.py index 7fd5d27e5..a210991f4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -40,7 +40,7 @@ 'pyfakefs==4.5.6', 'pytest-xdist==2.5.0', ] -REQUIREMENTS_BUILD = ['setuptools>=20.2'] +REQUIREMENTS_BUILD = ['setuptools>=20.2', 'wheel>=0.40'] nox.options.reuse_existing_virtualenvs = True nox.options.sessions = [ @@ -169,22 +169,21 @@ def cover(session): @nox.session(python=PYTHON_DEFAULT_VERSION) def build(session): """Build the distribution.""" - # TODO: consider using wheel as well session.run('pip', 'install', *REQUIREMENTS_BUILD) session.run('python', 'setup.py', 'check', '--metadata', '--strict') session.run('rm', '-rf', 'build', 'dist', 'b2sdk.egg-info', external=True) session.run('python', 'setup.py', 'sdist', *session.posargs) + session.run('python', 'setup.py', 'bdist_wheel', *session.posargs) # Set outputs for GitHub Actions if CI: - asset_path = glob('dist/*')[0] - print('::set-output name=asset_path::', asset_path, sep='') + with open(os.environ['GITHUB_OUTPUT'], 'a') as github_output: + # Path have to be specified with unix style slashes even for windows, + # otherwise glob won't find files on windows in action-gh-release. + print('asset_path=dist/*', file=github_output) - asset_name = os.path.basename(asset_path) - print('::set-output name=asset_name::', asset_name, sep='') - - version = os.environ['GITHUB_REF'].replace('refs/tags/v', '') - print('::set-output name=version::', version, sep='') + version = os.environ['GITHUB_REF'].replace('refs/tags/v', '') + print(f'version={version}', file=github_output) @nox.session(python=PYTHON_DEFAULT_VERSION)