Skip to content

Commit

Permalink
Add an action to publish wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
peytondmurray committed May 21, 2024
1 parent deb80f4 commit d365cfa
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 46 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish to PyPI

on:
pull_request:
workflow_dispatch:
release:
types: [published]

jobs:
build:
name: >
build ${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }}
${{ (matrix.arch) || '' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
python-version: ['cp312', 'cp311']

runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_BUILD: '${{ matrix.python-version }}-*'
CIBW_ARCHS: ${{ matrix.arch || 'auto' }}

- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.python-version }}
path: ./wheelhouse/*.whl

upload:
name: Upload wheels to PYPI
runs-on: ubuntu-latest
if: (github.event_name == 'release' && startsWith(github.ref, 'refs/tags')) || (github.event_name == 'workflow_dispatch')
needs: [build_wheels, build_sdist]
environment:
name: pypi
url: https://pypi.org/p/pyforc
permissions:
id-token: write
steps:
- name: Retrieve wheels and sdist
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: wheels/

- name: List all built wheels
run: |
ls -lAs wheels/
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.8
with:
packages_dir: wheels/
45 changes: 0 additions & 45 deletions .github/workflows/python-publish.yml

This file was deleted.

17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,22 @@ FORC analysis in Python.

## Installation

Install by cloning this repo and running
### Install from PyPI

The easiest way to get started is by installing via `pip`:

`pip install pyforc`

This will grab the latest published release on the Python Package Index and
install it to your current python environment.

### Installation from source

Install from source by doing

`pip install git+https://github.com/peytondmurray/pyforc`

Alternatively you can clone this repo and run

`pip install .`

Expand Down

0 comments on commit d365cfa

Please sign in to comment.