Skip to content

Commit

Permalink
170 create an action to publish to pypi when we make a release (#179)
Browse files Browse the repository at this point in the history
* testing package publishing

* triggering

* maybe wheels aren't necessary for this

* fixing thing

* don't think we need an sdist

* lets have both, why not

* adding both files to cache

* removing push trigger

* considering auto incrementing version

* checking a version bump PR

* maybe this

* maybe it needs the branch name?

* maybe this

* trying to see if any changes are applied

* debug

* trying to get a PR to work

* one more time

* sure would like this to work

* what is happening

* i give up
  • Loading branch information
K20shores authored Aug 13, 2024
1 parent ad63fbb commit d9f67f7
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 27 deletions.
66 changes: 40 additions & 26 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,49 @@
name: Publish a pypi package
name: Publish Python Package

on:
workflow_dispatch:
release:
types: [created]
types:
- published

jobs:
publish_to_pypi:
build_sdist:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build SDist and Wheel
run: pipx run build --sdist --wheel

- name: Check metadata
run: pipx run twine check dist/*

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*

upload_all:
name: Upload release
needs: [build_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/acom_music_box
permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build and publish package
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
pipx run build
pipx run twine check dist/*
python -m twine upload --repository pypi dist/*
- uses: actions/setup-python@v5
with:
python-version: "3.x"

- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion src/acom_music_box/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This package contains modules for handling various aspects of a music box,
including species, products, reactants, reactions, and more.
"""
__version__ = "2.1.1"
__version__ = "2.1.5"

from .utils import convert_time, convert_pressure, convert_temperature, convert_concentration
from .music_box_species import Species
Expand Down

0 comments on commit d9f67f7

Please sign in to comment.