Skip to content

Merge pull request #8 from davidnabergoj/updates #19

Merge pull request #8 from davidnabergoj/updates

Merge pull request #8 from davidnabergoj/updates #19

Workflow file for this run

name: Build/test/release
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'bootplot/__version__.py' # Only run workflow on pushes where __version__.py was changed
jobs:
build-n-publish:
permissions: write-all
name: Build and publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Build source and wheel distributions
run: |
python -m pip install --upgrade build twine pytest
python -m build
twine check --strict dist/*
- name: Install bootplot from the wheel file
run: |
pip install dist/*.whl
- name: List the installed packages
run: |
pip freeze
- name: Run tests
run: |
pytest
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(cat bootplot/__version__.py | grep version | cut -d'"' -f 2)
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, no need to create our own
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
- name: Get Asset name
run: |
export PKG=$(ls dist/ | grep tar)
set -- $PKG
echo "name=$1" >> $GITHUB_ENV
- name: Upload Release Asset (sdist) to GitHub
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/${{ env.name }}
asset_name: ${{ env.name }}
asset_content_type: application/zip