Skip to content

Merge pull request #64 from AryaXAI/serverless-case #103

Merge pull request #64 from AryaXAI/serverless-case

Merge pull request #64 from AryaXAI/serverless-case #103

Workflow file for this run

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: |
TAG_NAME=$(gh release view --json tagName | jq -r .tagName)
RELEASE_NOTES=$(gh release view --json url | jq -r .url)
RELEASE_NOTES="${RELEASE_NOTES//$'\n'/\\n}"
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_OUTPUT
echo "RELEASE_NOTES=${RELEASE_NOTES}" >> $GITHUB_OUTPUT
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'
payload: |
{
"text": "AryaXAI SDK release",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Version:* ${{ steps.release_notes.outputs.TAG_NAME }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Release Notes:* ${{ steps.release_notes.outputs.RELEASE_NOTES }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*PyPI URL:* https://pypi.org/project/aryaxai/${{ steps.release_notes.outputs.TAG_NAME }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}