Skip to content

Commit

Permalink
Updated to trusted publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
JMaynor committed Aug 27, 2024
1 parent 83a9c6f commit 60bc878
Showing 1 changed file with 38 additions and 25 deletions.
63 changes: 38 additions & 25 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,52 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# Workflow will publish a Python package to PyPI when a new release is created

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build

- name: Archive the dist folder
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
retention-days: 1

deploy:
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Download the dist folder from the build job
uses: actions/download-artifact@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
name: dist
path: dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 60bc878

Please sign in to comment.