Skip to content

Commit

Permalink
trusted publisher pypi workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
moradology committed Apr 15, 2024
1 parent 84c11dc commit 61c3a74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 29 deletions.
25 changes: 9 additions & 16 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,16 @@ on:
- created

jobs:
release:
name: release
pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
if: ${{ github.repository }} == 'moradology/beam-pyspark-runner'
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: python -m pip install tox
# retrieve your distributions here

- name: Release
run: tox -e release
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
13 changes: 0 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,3 @@ deps = build
commands =
python -c "import shutil; shutil.rmtree('dist', ignore_errors=True)"
python -m build

[testenv:release]
basepython = python3
passenv =
TWINE_PASSWORD
setenv =
TWINE_USERNAME = {env:TWINE_USERNAME:__token__}
deps =
{[testenv:build]deps}
twine >= 4.0.2
commands =
{[testenv:build]commands}
python -m twine upload --verbose dist/*

0 comments on commit 61c3a74

Please sign in to comment.