Version 0.6.0 #14
Workflow file for this run
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
# This workflow will upload the pyclang Python package when a release is created | |
name: PyPI release | |
on: | |
release: | |
types: [released] | |
jobs: | |
build_and_upload: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@master | |
with: | |
python-version: '3.7' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install twine build | |
- name: Build and upload pyclang ${{ github.event.release.tag_name }} | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
PUBLISHED_VERSION=$(curl https://pypi.org/pypi/pyclang/json 2>/dev/null | jq -r '.info.version') | |
CURRENT_VERSION=$(python setup.py --version 2>/dev/null) | |
if [ "$PUBLISHED_VERSION" == "$CURRENT_VERSION" ]; then | |
echo "Version ${PUBLISHED_VERSION} already published, skipping..." | |
exit 1 | |
else | |
echo "Packaging and publishing new pyclang version: ${CURRENT_VERSION}" | |
python -m build | |
twine upload --verbose dist/* | |
fi |