Skip to content

Commit

Permalink
Remove environment.url section from the publish-to-pypi workflow.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 718984626
  • Loading branch information
lukmaz authored and The Meridian Authors committed Jan 23, 2025
1 parent dba2ebd commit ea12972
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/pytest_and_autopublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ jobs:
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/google-meridian
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

Expand All @@ -98,6 +95,12 @@ jobs:
with:
name: python-package-distributions
path: dist/
- name: Print OIDC Token (DEBUG ONLY)
run: |
TOKEN=$(echo ${{ secrets.ACTIONS_ID_TOKEN_REQUEST_TOKEN }})
echo "OIDC Token: $TOKEN"
echo "Decoded Token (Part 2 - Payload):"
echo "$TOKEN" | cut -d '.' -f 2 | base64 -d
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/test3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: test3

on:
workflow_dispatch:
inputs:
publish_to_pypi:
description: 'Publish to PyPI?'
required: true # Changed to true
type: boolean
default: false
push:
branches:
- '**'

jobs:
publish-to-pypi:
if: github.event.inputs.publish_to_pypi == 'true'
runs-on: ubuntu-latest
environment:
name: pypi
permissions:
id-token: write

steps:
- name: Print OIDC Token (DEBUG ONLY)
run: |
TOKEN=$(echo ${{ secrets.ACTIONS_ID_TOKEN_REQUEST_TOKEN }})
echo "OIDC Token: $TOKEN"
echo "Decoded Token (Part 2 - Payload):"
echo "$TOKEN" | cut -d '.' -f 2 | base64 -d
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true

0 comments on commit ea12972

Please sign in to comment.