Skip to content

Merge pull request #21 from TREX-CoE/docs_motype #72

Merge pull request #21 from TREX-CoE/docs_motype

Merge pull request #21 from TREX-CoE/docs_motype #72

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 }}