fix: update PublishToPyPI Workflow Actions' versions #11
This file contains 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
# Triggered on push events to the main branch. | ||
# Publishes the package to PyPI only on tag pushes. | ||
name: 🐍 📦 Publish Python distribution to PyPI and TestPyPI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
jobs: | ||
build: | ||
name: Build distribution 📦 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 🐍 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- name: Install Poetry 📖 | ||
uses: snok/install-poetry@93ada01c735cc8a383ce0ce2ae205a21c415379b | ||
- name: Setup Poetry 📚 | ||
uses: Gr1N/setup-poetry@v8 | ||
- name: Build distribution 📦 | ||
run: poetry build | ||
- name: Store the distribution artifact 🥶 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
publish-to-pypi: | ||
name: Publish distro to PyPI 🐍 📦 | ||
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
environment: | ||
name: prod | ||
url: https://pypi.org/p/dbt-datadict | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf | ||
with: | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
publish-to-testpypi: | ||
name: Publish distro to TestPyPI 🐍 📦 | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
environment: | ||
name: test | ||
url: https://test.pypi.org/p/dbt-datadict | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution 📦 to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
skip-existing: true |