Merge pull request #38 from v1j4y/orca_bug_fig #87
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
on: | |
push: | |
branches: [ master ] | |
release: | |
types: | |
- published | |
name: Publish Python distributions to PyPI | |
jobs: | |
get_commit_message: | |
name: Get commit message | |
runs-on: ubuntu-latest | |
outputs: | |
message: ${{ steps.commit_message.outputs.message }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v3 | |
# Gets the correct commit message for pull request | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Get commit message | |
id: commit_message | |
run: | | |
set -xe | |
COMMIT_MSG=$(git log --no-merges -1 --oneline) | |
echo "::set-output name=message::$COMMIT_MSG" | |
build-n-publish: | |
name: Build and publish Python π distributions π¦ to PyPI | |
needs: get_commit_message | |
# The Python package will be published to PyPI only if commit contains | |
# [pypi release] trigger in its message or if there is a release on GitHub. | |
# NOTE: do not forget to update the `version` parameter in `setup.cfg` before pushing ! | |
if: >- | |
contains(needs.get_commit_message.outputs.message, '[pypi release]') || | |
github.event_name == 'release' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install PyPA build and setuptools | |
run: python -m pip install -U setuptools build --user | |
- name: Build a binary wheel and a source tarball | |
run: python -m build --sdist --wheel --outdir dist/ . | |
- name: List all produced packages and wheels | |
run: ls -sh -w 1 | |
working-directory: dist | |
#- name: Publish distribution π¦ to Test PyPI | |
# uses: pypa/gh-action-pypi-publish@master | |
# with: | |
# password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
# repository_url: https://test.pypi.org/legacy/ | |
- name: Publish distribution π¦ to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |