🚨 style(tests): Add new line after module's docstring #287
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: Release | |
# detect new version and create tag for it, build Python 📦 | |
# generate release notes for GitHub release | |
# If tag for new version was created, then publish GitHub release | |
# publish Python 📦 to PyPI (if tag exists) and 🧪TestPyPI (if it was a merged PR) | |
env: | |
# Specify Python version to quick change in the future | |
# See: https://github.com/actions/setup-python/tree/main#available-versions-of-python | |
PYTHON_VERSION: "3.11" | |
on: | |
push: | |
branches: | |
- main | |
- master | |
jobs: | |
build-package-and-publish-gh-release: | |
name: Release | |
runs-on: ubuntu-latest | |
outputs: | |
output1: ${{ steps.check-version.outputs.tag }} | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Upgrade pip | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt pip | |
pip --version | |
- name: Install Poetry | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt poetry | |
poetry --version | |
- name: Check if there is a parent commit | |
id: check-parent-commit | |
run: | | |
echo "sha=$(git rev-parse --verify --quiet HEAD^)" >> $GITHUB_OUTPUT | |
- name: Detect and tag new version | |
id: check-version | |
if: steps.check-parent-commit.outputs.sha | |
uses: salsify/action-detect-and-tag-new-version@v2 | |
with: | |
version-command: | | |
bash -o pipefail -c "poetry version | awk '{ print \$2 }'" | |
- name: Bump version for developmental release | |
if: steps.check-version.outputs.tag != '' | |
run: | | |
poetry version patch && | |
version=$(poetry version | awk '{ print $2 }') && | |
poetry version $version.dev.$(date +%Y%m%d%H%M%S) | |
- name: Build a binary wheel (.whl) | |
run: | | |
poetry build --ansi | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish the release notes | |
uses: release-drafter/release-drafter@master | |
with: | |
publish: ${{ steps.check-version.outputs.tag != '' }} | |
tag: ${{ steps.check-version.outputs.tag }} | |
name: ${{ steps.check-version.outputs.tag }} of Playlist Along | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-to-pypi: | |
name: >- | |
📦 to PyPI | Publish Python 🐍 distribution | |
if: needs.build-package-and-publish-gh-release.outputs.output1 | |
needs: | |
- build-package-and-publish-gh-release | |
runs-on: ubuntu-latest | |
environment: | |
name: 'PyPI' | |
url: https://pypi.org/p/playlist-along | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all built files | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
publish-to-test-pypi: | |
name: 📦 to 🧪TestPyPI | Publish Python 🐍 distribution | |
needs: | |
- build-package-and-publish-gh-release | |
runs-on: ubuntu-latest | |
environment: | |
name: 'Test PyPI' | |
url: https://test.pypi.org/p/playlist-along | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all built file | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish 📦 to 🧪TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ |