Skip to content

Publish to PyPI

Publish to PyPI #19

Workflow file for this run

name: Publish to PyPI
on:
push:
branches:
- master
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install setuptools build
- name: Build
run: |
python3 -m build
- name: Make sure version in atom_tools.__init__.py has been updated
# if: startsWith(github.ref, 'refs/tags/')
run: |
version=$(python3 -c 'from atom_tools.__init__ import __version__; print(f"refs/tags/v{__version__}")')
if "$version" != "${{ github.ref }}"; then
echo "Version in atom_tools.__init__.py has not been updated. $version != ${{ github.ref }}"
exit 1
fi
- name: Publish package distributions to PyPI
if: startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@release/v1