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

Add publish.yml GitHub Action job to upload urdfdom-py to PyPI #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
66 changes: 66 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Publish Python distributions to PyPI

on:
push:
branches: ["**"]
tags-ignore: ["**"]
pull_request:
release:
types:
- published
jobs:
build_wheels:
name: Build wheels [${{ matrix.os }}]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- 3.11
os:
- ubuntu-24.04

Comment on lines +21 to +22
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ubuntu-24.04
- ubuntu-24.04
- macos-latest

this should be okay

steps:
# We do not release exactly the 1.2.1 tag as we need
# to actually release on urdfdom-py
- uses: actions/checkout@v4
with:
repository: 'ros/urdf_parser_py'
ref: '492223ce830cafc4dc2dcd98b82bb0eb91511118'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install pypa/build
run: pip install build

- name: Build wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .

- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist

deploy:
name: Deploy to PyPI
runs-on: ubuntu-24.04
Comment on lines +49 to +50
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: Deploy to PyPI
runs-on: ubuntu-24.04
name: Deploy to PyPI
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- 3.11
os:
- ubuntu-24.04
- macos-latest

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wheel is pure python, so I do not think we do not need to publish a different one for each os, just uploading it on Linux is fine and will produce a package that should work fine also on macos.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok! I wasn't sure about this, but you're probably right

needs: [build_wheels]
if: startsWith(github.ref, 'refs/tags')
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist

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