-
Notifications
You must be signed in to change notification settings - Fork 5
43 lines (40 loc) · 1.36 KB
/
python_cd.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: Python CD
on:
pull_request:
release:
types: [ published ]
jobs:
publish-pypi-package:
if: github.event_name == 'release'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify the tag version in the pyproject.toml
run: grep -q "version = \"${{ github.event.release.tag_name }}\"" pyproject.toml || exit 1
shell: bash
- uses: ./.github/actions/python_prepare
- name: Build and Publish
run: poetry publish -p ${{ secrets.PYPI_TOKEN }} -u "__token__" --build
shell: bash
publish-dev-package:
if: contains(github.event.pull_request.body, 'deploy please') && github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/python_prepare
- name: Set Development Version
run: |
current_version=$(poetry version -s)
poetry version "${current_version}.dev${{ github.run_number }}"
shell: bash
- name: Build and Publish Development Package
run: poetry publish -p ${{ secrets.PYPI_TOKEN }} -u "__token__" --build
shell: bash