2023-12-19 14:33:19 +00:00
|
|
|
name: Publish Python 🐍 distributions 📦 to PyPI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-n-publish:
|
|
|
|
name: Build and publish Python 🐍 distributions 📦 to PyPI
|
2023-12-19 15:24:47 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-12-19 14:33:19 +00:00
|
|
|
|
|
|
|
steps:
|
2023-12-19 15:24:47 +00:00
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
2023-12-19 14:33:19 +00:00
|
|
|
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
2023-12-19 15:57:03 +00:00
|
|
|
python-version: 3.
|
|
|
|
|
|
|
|
- name: Get the version
|
|
|
|
id: get_version
|
2023-12-19 16:14:33 +00:00
|
|
|
run: |
|
2023-12-19 16:31:39 +00:00
|
|
|
echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
|
2023-12-19 16:27:18 +00:00
|
|
|
|
|
|
|
- name: Print the version
|
|
|
|
run: |
|
2023-12-19 16:23:36 +00:00
|
|
|
echo ${{ env.VERSION }}
|
2023-12-19 16:27:18 +00:00
|
|
|
echo ${{ github.ref }}
|
2023-12-19 16:31:39 +00:00
|
|
|
ls ./package/dist/
|
2023-12-19 16:37:00 +00:00
|
|
|
cat ./package/setup.py
|
2023-12-19 14:33:19 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2023-12-19 16:44:09 +00:00
|
|
|
python -m pip install build towncrier setuptools wheel
|
2023-12-19 15:57:03 +00:00
|
|
|
|
|
|
|
- name: Generate release notes
|
|
|
|
run: |
|
|
|
|
towncrier --draft > release_notes.txt
|
2023-12-19 14:33:19 +00:00
|
|
|
|
|
|
|
- name: Generate version notes with towncrier
|
|
|
|
run: |
|
|
|
|
towncrier --yes
|
|
|
|
|
|
|
|
- name: Build a binary wheel and a source tarball
|
|
|
|
run: |
|
|
|
|
cd package
|
2023-12-19 16:50:12 +00:00
|
|
|
python setup.py upload
|
2023-12-19 16:37:00 +00:00
|
|
|
ls ./dist/
|
2023-12-19 14:33:19 +00:00
|
|
|
|
|
|
|
- name: Publish distribution 📦 to PyPI
|
|
|
|
run: |
|
|
|
|
cd package
|
|
|
|
pip install twine
|
|
|
|
twine upload dist/*
|
|
|
|
env:
|
|
|
|
TWINE_USERNAME: __token__
|
|
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
2023-12-19 15:57:03 +00:00
|
|
|
|
|
|
|
- name: Create Release
|
2023-12-19 16:23:36 +00:00
|
|
|
id: create_release
|
2023-12-19 15:57:03 +00:00
|
|
|
uses: actions/create-release@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
|
|
with:
|
|
|
|
tag_name: ${{ github.ref }}
|
|
|
|
release_name: Release ${{ github.ref }}
|
|
|
|
body_path: release_notes.txt
|
|
|
|
|
|
|
|
- name: Upload Release Asset gz
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
2023-12-19 16:14:33 +00:00
|
|
|
asset_path: ./package/dist/NeteaseCloudMusic-${{ env.VERSION }}.tar.gz
|
|
|
|
asset_name: NeteaseCloudMusic-${{ env.VERSION }}.tar.gz
|
2023-12-19 15:57:03 +00:00
|
|
|
asset_content_type: application/zip
|
|
|
|
|
|
|
|
- name: Upload Release Asset whl
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
2023-12-19 16:14:33 +00:00
|
|
|
asset_path: ./package/dist/NeteaseCloudMusic-${{ env.VERSION }}-py2.py3-none-any.whl
|
|
|
|
asset_name: NeteaseCloudMusic-${{ env.VERSION }}-py2.py3-none-any.whl
|
2023-12-19 15:57:03 +00:00
|
|
|
asset_content_type: application/zip
|