Fix release deprecated action #73
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 🐍 Distribution 📦 to PyPI and TestPyPI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
jobs: | |
build: | |
name: Build Distribution 📦 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set Up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.*" | |
- name: Install Build Dependencies | |
run: pip install ".[build]" | |
- name: Build Distribution Packages | |
run: python3 -m build | |
- name: Upload Distribution Packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
publish-to-pypi: | |
name: Publish Distribution 📦 to PyPI | |
if: startsWith(github.ref, 'refs/tags/') # Only publish on tag pushes | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/brazilcep | |
permissions: | |
id-token: write | |
steps: | |
- name: Download Distribution Packages | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |