Publish Python Package #6
Workflow file for this run
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
# Triggers a pypi publication when a release is created | |
name: Publish Python Package | |
on: | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
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 | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ./dist | |
pypi-publish: | |
needs: ['build'] | |
environment: | |
name: publish | |
url: 'https://pypi.org/project/labelbigquery/' | |
runs-on: ubuntu-latest | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1.8 | |
with: | |
packages-dir: artifact/ | |
# Note that the build and pypi-publish jobs are split so that the additional permissions are only granted to the pypi-publish job. |