Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update pypi release workflow to use trusted env #1265

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release_gcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:

jobs:
publish:
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
Expand Down
34 changes: 20 additions & 14 deletions .github/workflows/release_pypi.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
name: Release - PyPI

on:
push:
tags:
- 'v*' # Trigger on version tags
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g., v1.0.0)'
required: true
type: string
release:
types: [published]
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-24.04
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

environment:
name: pypi

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -35,8 +33,16 @@ jobs:
- name: Build package
run: python -m build

- name: Upload to PyPI
env:
TWINE_REPOSITORY: testpypi
- name: Check distribution
run: |
twine upload --verbose dist/*
twine check dist/*
if [ $? -ne 0 ]; then
echo "Invalid distribution files"
exit 1
fi

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: dist/