Skip to content

Commit

Permalink
Update publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecThomson authored Dec 4, 2024
1 parent e81f7ba commit 3acb451
Showing 1 changed file with 54 additions and 9 deletions.
63 changes: 54 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,60 @@
name: PyPi
name: Publish

on:
workflow_dispatch:
pull_request:
push:
tags:
- "v*.*.*"
branches:
- main
release:
types:
- published

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
# Many color libraries just need this to be set to any value, but at least
# one distinguishes color depth, where "3" -> "256-bit color".
FORCE_COLOR: 3

jobs:
build:
dist:
name: Distribution build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build and publish to pypi
uses: JRubics/[email protected]
- uses: actions/checkout@v4
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
plugins: "poetry-dynamic-versioning[plugin]"
fetch-depth: 0

- uses: hynek/build-and-inspect-python-package@v2

publish:
needs: [dist]
name: Publish to PyPI
environment: pypi
permissions:
id-token: write
attestations: write
contents: read
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Generate artifact attestation for sdist and wheel
uses: actions/[email protected]
with:
subject-path: "dist/*"

- uses: pypa/gh-action-pypi-publish@release/v1
# with:
# Remember to tell (test-)pypi about this repo before publishing
# Remove this line to publish to PyPI
# repository-url: https://test.pypi.org/legacy/

0 comments on commit 3acb451

Please sign in to comment.