Skip to content

Update publishing to Pypi #173

Update publishing to Pypi

Update publishing to Pypi #173

name: publish-pypi
on:
push:
branches:
- master
release:
types: [published]
jobs:
build:
name: Build Python distributions
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.10
if: github.repository_owner == 'ctlab'
- name: Check out src from Git
uses: actions/checkout@v4
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
if: github.repository_owner == 'ctlab'
- name: Install flit
run: |
pip install flit
if: github.repository_owner == 'ctlab'
- name: Create pip package
run: |
flit build
if: github.repository_owner == 'ctlab'
publish-to-testpypi:
name: Publish distribution 📦 to TestPyPI
if: github.repository_owner == 'ctlab'
needs:
- build
runs-on: ubuntu-20.04
environment:
name: publish-testpypi
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Publish distribution 📦 to Test PyPI
run: |
flit publish
env:
FLIT_INDEX_URL: https://test.pypi.org/p/gadma
FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }}
FLIT_USERNAME: __token__
publish-to-pypi:
name: Publish distribution 📦 to PyPI
if: github.repository_owner == 'ctlab' && github.event.release
needs:
- build
runs-on: ubuntu-20.04
environment:
name: publish-pypi
url: https://pypi.org/p/gadma
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Publish distribution 📦 to PyPI
run: |
flit publish
env:
FLIT_INDEX_URL: https://test.pypi.org/p/gadma
FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }}
FLIT_USERNAME: __token__