Release Python Package #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will upload a Python Package using Twine when a release is created | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries | |
# Idea: https://stackoverflow.com/a/63352329/3753684 | |
name: Release Python Package | |
on: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
jobs: | |
add-github-release: | |
name: Create GitHub Release (as draft) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
deploy-to-pypi: | |
needs: add-github-release # This is important to keep things in sync | |
name: Deploy as PyPI Package | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' # The latest stable version of CPython 3 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
run: python -m build ros2_easy_test | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # Version v1.8.14 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |