name: Release on GitHub & PyPI on: push: tags: - 'v*' jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - run: pip install -U poetry twine wheel - run: poetry build - run: twine upload --non-interactive -u __token__ -p ${{ secrets.PYPI_TOKEN }} dist/* - run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - run: gh release create -t "Release ${{ env.TAG}}" -n "$(awk '/## \[${{ env.TAG }}] - /{flag=1;next}/## \[/{flag=0}flag' CHANGELOG.md)" ${{ env.TAG }} dist/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}