Merge pull request #98 from ivanildobarauna-dev/hotfix/context-manager #44
This file contains hidden or 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
name: Publish Python Package | |
on: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: write | |
jobs: | |
publish: | |
name: Build and publish to PyPI | |
runs-on: ubuntu-latest | |
environment: Production | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.6.1 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Install dependencies | |
run: | | |
poetry install --no-interaction | |
- name: Extract version | |
id: extract_version | |
run: | | |
VERSION=$(poetry version -s) | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "Versão encontrada: $VERSION" | |
- name: Build package | |
run: | | |
poetry build | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v${{ steps.extract_version.outputs.version }} | |
name: Release v${{ steps.extract_version.outputs.version }} | |
draft: false | |
prerelease: false | |
files: | | |
dist/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish to PyPI | |
run: | | |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} | |
poetry publish | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} |