Merge pull request #54 from rahil-makadia/dev #177
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-14] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Set up Xcode | |
if: matrix.os == 'macos-14' | |
uses: maxim-lobanov/setup-xcode@v1.6.0 | |
with: | |
xcode-version: '15.1.0' | |
- name: Install doxygen | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get install doxygen | |
- name: Install doxygen | |
if: matrix.os == 'macos-14' | |
run: brew install doxygen | |
- name: Initialize repository | |
run: | | |
source initialize.sh --no-tm-overwrite | |
- 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-14 | |
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 }} |