Skip to content

Fix: Allow install source with pip/pipenv (#37) #45

Fix: Allow install source with pip/pipenv (#37)

Fix: Allow install source with pip/pipenv (#37) #45

Workflow file for this run

# This workflow will upload a Python Package using Twine when a release is created
# For more information see:
# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: PyPI
on:
workflow_dispatch: ~
release:
types: [published]
push:
tags:
- '*.*.*'
env:
DEFAULT_PYTHON: "3.10"
jobs:
pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Set version variable
id: version
run: |
if [[ "${GITHUB_REF#refs/heads/}" = "${GITHUB_REF}" ]]; then
APP_VERSION=${GITHUB_REF#refs/tags/}
else
git fetch --tags --unshallow
version=$(git describe --tags --abbrev=0)
subver=${{ github.run_number }}
APP_VERSION=$version.post$subver
fi
echo "version=$APP_VERSION" >> $GITHUB_OUTPUT
- name: Install dependencies and build
env:
APP_VERSION: ${{ steps.version.outputs.version }}
run: |
# Setup version
set -x
echo "__version__ = '$APP_VERSION'" > trakt/__version__.py
cat trakt/__version__.py
python -c "from trakt import __version__; print(__version__)"
# Build the package
python -m pip install --upgrade build
python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
# vim:ts=2:sw=2:et