Skip to content

Add pypi upload

Add pypi upload #1

name: 🚨🚀 Upload source distribution
on:
push:
paths-ignore:
- '**.md'
branches:
- 'long_lived/**'
- main
- 'release/**'
release:
types: [published]
pull_request:
paths-ignore:
- '**.md'
branches:
- '**'
concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }}
cancel-in-progress: true
permissions:
contents: read
id-token: write
jobs:
upload_source_dist:
name: Upload source distribution
runs-on: [ubuntu-latest]
timeout-minutes: 30
steps:
- name: Add safe git directory
uses: chia-network/actions/git-mark-workspace-safe@main
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- uses: Chia-Network/actions/setup-python@main
name: Install Python
with:
python-version: '3.10'
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python.major_dot_minor }}
development: true
- uses: chia-network/actions/activate-venv@main
- name: Build source distribution
run: |
python -m build --sdist --outdir dist .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
skip-existing: true