Skip to content

Publish releases to PyPI #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 37 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
name: Build BEMEWS

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
# Workflow that builds and tests the BEMEWS package on every pull request
# and on every push to the main branch. If a new version tag is pushed, the
# workflow will also publish the package to PyPI.

on:
push:
branches: [ main ]
tags: # Sequence of patterns matched against refs/tags
- 'v*' # Any tag matching v*, e.g. v1.0, v1.2b1
pull_request:
branches: [ main ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
strategy:
fail-fast: false
matrix:
os: [macos-latest] # [macos-latest, ubuntu-latest, windows-latest]
python-version: ['3.12'] # ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}

steps:
Expand Down Expand Up @@ -52,3 +55,33 @@ jobs:
- name: Run example script
run: |
python BEMEWS_example.py

- name: Upload distributions
uses: actions/upload-artifact@v4
with:
path: dist/
name: release-dists-${{ matrix.os }}-${{ matrix.python-version }}
if-no-files-found: error

publish_to_pypi:
# Only run if a new tag was created …
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# … and if all builds above were successful
needs: build

runs-on: ubuntu-latest
permissions:
# See https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings
id-token: write
contents: read

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
path: dist/
pattern: release-dists-*
merge-multiple: true

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Image by dreamstudio.ai


# BEMEWS
A python module for calculating the Earth-matter Effect. Works standalone or with SNEWPY
A python module for calculating the Earth-matter Effect. BEMEWS is a standalone module which SNEWPY uses to compute the Earth-Matter Effect for supernova neutrinos. The BEMEWS_example.py script shows how to use the module in the standalone mode. The EarthMatter flavor transformation class in SNEWPY is essentially the same script but with the output turned off.

1) You will need the python-devel, pybind11 and setuptools packages

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ authors = [
{name="Anne Graf"},
]

version = "1.0"
version = "1.0a1"
requires-python = ">=3.9" # TODO: Also update classifiers below!
dependencies = [
"numpy >= 1.16",
Expand Down