Skip to content

Commit

Permalink
Enable Trusted Publishing for PyPI actions
Browse files Browse the repository at this point in the history
In order to use Trusted Publishing we have to do some special things.

Most of these things have been abstracted away through the official
action plugin provided by the Python Packaging Authority.

This change simply conforms our actions configs with the requirements
for the plugin. Specifically, providing the `id-token: write` permission
and the target URL for publication in the relevant environment config.
  • Loading branch information
tlento committed Jul 27, 2024
1 parent 7a58d59 commit 84720bc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/cd-push-dbt-metricflow-to-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ env:
jobs:
pypi-publish:
runs-on: ubuntu-latest
environment: Pypi Publish
environment:
name: Pypi Publish
url: https://pypi.org/p/dbt-metricflow
permissions:
id-token: write
steps:
- name: Check-out the repo
uses: actions/checkout@v3
Expand All @@ -22,6 +26,9 @@ jobs:
with:
python-version: "${{ env.PYTHON_VERSION }}"

- name: Hatch Publish `dbt-metricflow`
- name: Build `dbt-metricflow` package
working-directory: ./dbt-metricflow
run: hatch build && hatch publish
run: hatch build

- name: Publish `dbt-metricflow` package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
13 changes: 10 additions & 3 deletions .github/workflows/cd-push-metricflow-to-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ env:
jobs:
pypi-publish:
runs-on: ubuntu-latest
environment: Pypi Publish
environment:
name: Pypi Publish
url: https://pypi.org/p/metricflow
permissions:
id-token: write
steps:
- name: Check-out the repo
uses: actions/checkout@v3
Expand All @@ -23,5 +27,8 @@ jobs:
with:
python-version: "${{ env.PYTHON_VERSION }}"

- name: Hatch Publish `metricflow`
run: hatch build && hatch publish
- name: Build `metricflow` package
run: hatch build

- name: Publish `metricflow` package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 84720bc

Please sign in to comment.