Skip to content

Commit

Permalink
Switch release workflow to OIDC (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored May 13, 2024
1 parent dcb3e0e commit f3f355b
Showing 1 changed file with 45 additions and 17 deletions.
62 changes: 45 additions & 17 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,59 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [published]
types:
- published

jobs:
deploy:
permissions: {}

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4.1.4

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v5.1.0
with:
python-version: '3.x'
python-version: "3.x"

- name: Verify version
uses: home-assistant/actions/helpers/verify-version@master

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
pip install setuptools build
- name: Build
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
python -m build
- name: Upload dists
uses: actions/upload-artifact@v4.3.3
with:
name: "dist"
path: "dist/"
if-no-files-found: error
retention-days: 5

publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
needs: "build"
environment:
name: release
url: https://pypi.org/p/pycognito
permissions:
id-token: write
steps:
- name: Download dists
uses: actions/download-artifact@v4.1.7
with:
name: "dist"
path: "dist/"

- name: Publish dists to PyPI
# Pinned to a commit for security purposes
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14

0 comments on commit f3f355b

Please sign in to comment.