Skip to content

Commit

Permalink
Publishing Action
Browse files Browse the repository at this point in the history
Add a workflow for publishing to pypi via openid connect configuration.
  • Loading branch information
sernst committed Jan 20, 2024
1 parent 7f42dc4 commit c29db8b
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Publish to PyPI
on:
push:
tags:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#patterns-to-match-branches-and-tags
- "v[12].[0-9]+.[0-9]+"
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- uses: actions/checkout@v4
# Poetry must be installed before python setup for caching to work.
# https://github.com/actions/setup-python/issues/369
- name: Install Poetry
run: pipx install poetry
# https://github.com/actions/setup-python
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: poetry
# https://github.com/abatilo/actions-poetry/blob/master/action.yml
- name: Build package
run: poetry build
# https://github.com/actions/upload-artifact
- name: Store Package Artifacts
uses: actions/upload-artifacts@v4
with:
name: dist
path: dist/

publish:
name: publish
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/dftxt
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
# https://github.com/actions/download-artifact
- name: Get Package Artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
# https://github.com/marketplace/actions/pypi-publish
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit c29db8b

Please sign in to comment.