This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 🏗️Build and 📦publish ☀️release | |
on: push | |
jobs: | |
build: | |
name: 🏗️ build package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.12 | |
- name: Install pypa/build | |
run: >- | |
python -m | |
pip install | |
build | |
--user | |
- name: Build a binary wheel and a source tarball | |
run: >- | |
python -m | |
build | |
--sdist | |
--wheel | |
--outdir dist/ | |
. | |
- uses: actions/upload-artifact@master | |
with: | |
name: buildfiles | |
path: . | |
publishtest: | |
if: "!startsWith(github.ref, 'refs/tags/v')" | |
name: 📦 publish to TestPyPI | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- uses: actions/download-artifact@master | |
with: | |
name: buildfiles | |
path: . | |
- name: Publish distribution 📦 to Test PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
publish: | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
name: 📦 publish to PyPI | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/download-artifact@master | |
with: | |
name: buildfiles | |
path: . | |
- name: Get version from tag | |
id: tag_name | |
run: | | |
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v} | |
- name: fetch changelog info | |
id: changelog_reader | |
uses: mindsers/changelog-reader-action@v2 | |
with: | |
version: ${{ steps.tag_name.outputs.current_version }} | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
release: | |
name: ☀️ create release | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
steps: | |
- uses: actions/download-artifact@master | |
with: | |
name: buildfiles | |
path: . | |
- name: Get version from tag | |
id: tag_name | |
run: | | |
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v} | |
- name: fetch changelog info | |
id: changelog_reader | |
uses: mindsers/changelog-reader-action@v2 | |
with: | |
version: ${{ steps.tag_name.outputs.current_version }} | |
- name: create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: dist/* | |
body: ${{ steps.changelog_reader.outputs.changes }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |