diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 05cfe68..b2afce6 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -1,37 +1,48 @@ -name: Publish Python 🐍 distributions 📦 to PyPI +name: Upload Python Package on: push: - branches: - - main - pull_request: - branches: - - main + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 jobs: - build-n-publish: - name: Build and publish Python 🐍 distributions 📦 to PyPI + release: + name: Create Release runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@master - - - name: Set up Python 3.7 - uses: actions/setup-python@v1 + - name: Checkout code + uses: actions/checkout@master + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token with: - python-version: 3.7 - - - name: Install package dependencies - run: python -m pip install .[dev] - - - name: Test with pytest - run: python -m pytest - - - name: Build a binary wheel and a source tarball - run: python setup.py sdist bdist_wheel - - - name: Publish distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.pypi_password }} + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body: | + Changes in this Release + draft: false + prerelease: false + deploy: + needs: release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel + - name: Build + run: | + python setup.py sdist bdist_wheel + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.pypi_password }} \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..dbb6fad --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,26 @@ +name: Test + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-18.04 + strategy: + max-parallel: 4 + matrix: + python-version: [3.5, 3.6, 3.7, 3.8] + steps: + - uses: actions/checkout@v2 + + - name: Set locale + run: sudo apt-get update && sudo apt-get install tzdata locales -y && sudo locale-gen pt_BR.UTF-8 + + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies with pip + run: | + python -m pip install .[dev] + - run: pytest \ No newline at end of file