Skip to content

Workflow file for this run

name: Publish Python 🐍 distribution 📦 to PyPI
on:
# workflow_run:
# workflows: ["Tests"]
# branches: [development]
# types:
# - completed
push:
branches:
- 'development'
# pull_request:
# branches:
# - 'development'
jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- 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@v3
with:
name: python-package-distributions
path: dist/
release:
name: Publish Python 🐍 distribution 📦 to TestPyPI
runs-on: ubuntu-latest
concurrency: release
permissions:
id-token: write
contents: read
environment:
name: testpypi
url: https://test.pypi.org/p/python-project-cli
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- uses: actions/checkout@v3
with:
fetch-depth: 0
# github_token: ${{ secrets.ACCESS_TOKEN }}
token: ${{ secrets.PAT }}
- name: Python Semantic Release
id: release
uses: python-semantic-release/[email protected]
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
# <other options here>
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish package to GitHub Release
uses: python-semantic-release/upload-to-gh-release@main
if: ${{ steps.release.outputs.released }} == 'true'
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
token: ${{ secrets.PAT }}
tag: ${{ steps.release.outputs.tag }}
# steps:
# - name: Download all the dists
# uses: actions/download-artifact@v3
# with:
# name: python-package-distributions
# path: dist/
# - name: Prepare package for release
# env:
# GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# run: semantic-release publish
# - name: Publish distribution 📦 to TestPyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository-url: https://test.pypi.org/legacy/