|
1 | | -# This workflows will upload a Python Package using Twine when a release is created |
2 | | -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries |
3 | | - |
4 | | -name: Upload Python Package |
| 1 | +name: Publish to PyPi |
5 | 2 |
|
6 | 3 | on: |
7 | 4 | release: |
8 | 5 | types: [created] |
9 | 6 |
|
10 | 7 | jobs: |
11 | | - deploy: |
| 8 | + check-docs-update: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + env: |
| 11 | + OS: ubuntu-latest |
| 12 | + PYTHON: '3.7' |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v2 |
| 15 | + - uses: technote-space/get-diff-action@v6 |
| 16 | + with: |
| 17 | + PATTERNS: | |
| 18 | + +(documentation)/*.md |
| 19 | + *.md |
| 20 | + CHANGE*.md |
| 21 | + FILES: | |
| 22 | + CHANGELOG.md |
12 | 23 |
|
13 | | - runs-on: ubuntu-latest |
| 24 | + - name: log git diff |
| 25 | + run: | |
| 26 | + echo ${{ env.GIT_DIFF }} |
| 27 | + echo ${{ env.MATCHED_FILES }} |
| 28 | + echo ${{ env.GIT_DIFF_FILTERED }} |
14 | 29 |
|
| 30 | + - name: Check if README.md or Doc/** is updated else exit |
| 31 | + if: (env.GIT_DIFF == '') |
| 32 | + run: | |
| 33 | + echo Update documentation files and README.md before push |
| 34 | + exit 1 |
| 35 | +
|
| 36 | + - name: push build status to Slack |
| 37 | + uses: 8398a7/action-slack@v3 |
| 38 | + with: |
| 39 | + status: ${{ job.status }} |
| 40 | + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest |
| 41 | + env: |
| 42 | + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 43 | + if: always() |
| 44 | + |
| 45 | + |
| 46 | + distribute: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + env: |
| 49 | + OS: ubuntu-latest |
| 50 | + PYTHON: '3.7' |
15 | 51 | steps: |
16 | 52 | - uses: actions/checkout@v2 |
17 | 53 | - name: Set up Python |
18 | 54 | uses: actions/setup-python@v2 |
19 | 55 | with: |
20 | | - python-version: '3.x' |
| 56 | + python-version: '3.7' |
| 57 | + |
21 | 58 | - name: Install dependencies |
22 | 59 | run: | |
23 | 60 | python -m pip install --upgrade pip |
24 | 61 | pip install setuptools wheel twine |
| 62 | +
|
25 | 63 | - name: Build and publish |
26 | 64 | env: |
27 | 65 | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
28 | 66 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
29 | 67 | run: | |
30 | 68 | python setup.py sdist bdist_wheel |
31 | 69 | twine upload dist/* |
| 70 | +
|
| 71 | + - name: push build status to Slack |
| 72 | + uses: 8398a7/action-slack@v3 |
| 73 | + with: |
| 74 | + status: ${{ job.status }} |
| 75 | + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest |
| 76 | + env: |
| 77 | + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 78 | + if: always() |
0 commit comments