Skip to content

bumped to version 1.3 #10

bumped to version 1.3

bumped to version 1.3 #10

name: Build and Publish
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11']
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Extract version from pyproject.toml
id: get_version
run: echo "::set-output name=version::$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")"
- name: Build package
run: python -m build
- name: Upload built packages to artifacts
uses: actions/upload-artifact@v2
with:
name: dist
path: dist/
- name: Publish package
if: github.ref == 'refs/heads/main' && matrix.python-version == '3.10'
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*
release:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: package
path: dist
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.build.outputs.version }}
name: Release ${{ needs.build.outputs.version }}
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}