Skip to content

Merge pull request #75 from rahil-makadia/dev #221

Merge pull request #75 from rahil-makadia/dev

Merge pull request #75 from rahil-makadia/dev #221

Workflow file for this run

name: Publish to PyPI
# run when pushes are made to main or dev branches and there are changes in the grss/version.txt file
on:
push:
branches:
- main
- dev
paths:
- "grss/version.txt"
permissions:
id-token: write
jobs:
build:
name: build ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Set up Xcode
if: matrix.os == 'macos-latest'
uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: '15.1.0'
- name: Get Pybind11
run: pip3 install "pybind11[global]>=2.10.0"
- name: Build python distributions
run: source build_python.sh
- name: Upload distribution for next job
uses: actions/upload-artifact@master
with:
name: dist-${{ matrix.os }}
path: dist
publish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Ubuntu distribution from previous job
uses: actions/download-artifact@master
with:
name: dist-ubuntu-latest
path: dist
- name: Download MacOS distribution from previous job
uses: actions/download-artifact@master
with:
name: dist-macos-latest
path: dist
- name: Show files
run: ls -l dist
- name: Publish to Test PyPI
if: github.ref == 'refs/heads/dev'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish to PyPI
if: github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}