-
Notifications
You must be signed in to change notification settings - Fork 3
43 lines (40 loc) · 1.27 KB
/
pypi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Publish Pypi Package
on:
push:
branches:
- main
paths:
- VERSION
workflow_dispatch:
env:
PIP_PACKAGE_NAME: rw-devtools
jobs:
publish-pypi:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get version
run: |-
if [[ -s VERSION ]]; then
VERSION=$(cat VERSION)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION extracted: $VERSION"
else
echo "VERSION file is missing or empty" >&2
exit 1
fi
- name: Build Package
run: |-
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
- name: Publish
run: |-
twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}
- name: Notify Slack of pip update
uses: slackapi/slack-github-action@v1.19.0
with:
channel-id: "#codecollections" # Slack channel id or name to post message. https://api.slack.com/methods/chat.postMessage#channels
slack-message: "Just deployed version ${{ env.VERSION }} of ${{ env.PIP_PACKAGE_NAME}} to https://pypi.org/project/${{ env.PIP_PACKAGE_NAME }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}