Skip to content

astral-sh/attest-action

Actions

About

A GitHub Action that generates PEP 740 publish attestations for your Python packages
v0.0.6
Latest
Star (5)

Verified

GitHub has manually verified the creator of the action as an official partner organization. For more info see About badges in GitHub Marketplace.

attest-action

Actions status Discord

A GitHub Action that generates PEP 740 publish attestations for your Python packages.

To use this action, you should be using Trusted Publishing to publish your packages (to pyx, PyPI, or another compatible index).

Warning

This action is currently in an early stage of development. Releases may contain significant breaking changes until it is declared stable.

Important

This action is primarily useful for directly publishing with uv publish and other upload tools that support PEP 740 attestations directly. You do not need this action if you're using pypa/gh-action-pypi-publish, as that action has built-in support for PEP 740 attestations.

Contents

Usage

Prerequisites

To use this action, you must have a Trusted Publisher configured for your project on your target index (or indices). Refer to your index's documentation for more information on Trusted Publishing:

As with Trusted Publishing itself, this action requires the id-token: write permission on your publishing job. For example:

permissions:
  id-token: write # for Trusted Publishing + attest-action
  contents: read # for actions/checkout, if you're in a private repo

In order to upload the resulting attestations to an index, you must use a publishing tool that supports PEP 740 attestations. Such tools include:

  • uv (uv publish) versions 0.9.12 and later
  • twine (twine upload) versions 5.1.0 and later

Tip

We recommend using uv publish with this action, as it does not require any additional installation or configuration.

Tip

This action will attempt to install uv if it is not already installed and available on the PATH.

Quickstart

Add astral-sh/attest-action directly above your publishing step in your publishing job.

For example:

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      id-token: write
      contents: read

    needs: [build]
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

      - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          name: dist

      - uses: astral-sh/attest-action@f589a42a7efb6fe400b4f400de60b4bc90390027 # v0.0.6

      - run: uv publish

Important

Performing builds in a separate job is strongly encouraged as a way to improve both security and reproducibility.

If you have a custom path (or paths) to your distributions, you can specify them via the paths input as whitespace-separated values.

- uses: astral-sh/attest-action@f589a42a7efb6fe400b4f400de60b4bc90390027 # v0.0.6
  with:
  paths: |
    custom-dist-dir/*
    wheelhouse/*

Inputs

paths

Default: dist/*

One or more whitespace-separated directories or glob patterns to search for Python distributions to generate attestations for.

Recursive globs may be used, e.g. dist/** to find all distributions within dist/ and its subdirectories.

Note

A bare directory path like dist/ is treated as dist/*.

overwrite

Default: false

If false (the default), any existing publish attestations that would have been overwritten will instead cause the action to fail.

If true, existing attestations will be overwritten.

Outputs

This action currently has no outputs.

Licence

attest-action is licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in attest-action by you, as defined in the Apache-2.0 license, shall be dually licensed as above, without any additional terms or conditions.

astral-sh/attest-action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

A GitHub Action that generates PEP 740 publish attestations for your Python packages
v0.0.6
Latest

Verified

GitHub has manually verified the creator of the action as an official partner organization. For more info see About badges in GitHub Marketplace.

astral-sh/attest-action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.