Publish to PyPI #60
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 | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '*.*.*' | |
- '!*.*.dev*' | |
jobs: | |
pypi: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Fetch tags | |
run: git fetch --prune --tags | |
- name: Get Release Notes | |
id: release_notes | |
run: | | |
RELEASE_NOTES=$(gh release view) | |
echo "::set-output name=text::$RELEASE_NOTES" | |
env: | |
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: Install dependencies and run tests | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install . | |
pip install pytest | |
pytest tests/ | |
continue-on-error: false | |
- name: Build package | |
run: python3 -m pip install --upgrade build && python3 -m build | |
# - name: Publish package to PyPI | |
# if: success() | |
# run: | | |
# python -m pip install --upgrade twine | |
# python -m twine upload dist/* | |
# env: | |
# TWINE_USERNAME: __token__ | |
# TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Send release notes to Slack | |
id: slack | |
uses: slackapi/slack-github-action@v1.24.0 | |
with: | |
# Slack channel id, channel name, or user id to post message. | |
# See also: https://api.slack.com/methods/chat.postMessage#channels | |
# You can pass in multiple channels to post to by providing a comma-delimited list of channel IDs. | |
channel-id: 'aryaxai-sdk-release' | |
# For posting a simple plain text message | |
slack-message: "Release notes:\n\n${{ steps.release_notes.outputs.text }}" | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |