-
Notifications
You must be signed in to change notification settings - Fork 4
70 lines (68 loc) · 2.19 KB
/
publish-pypi.yml
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# This workflows will upload a Python Packages upon merge
name: upload python packages
on:
workflow_dispatch:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
publish-pypi:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel poetry twine bump2version
# bump version type based on branch
- if: github.ref == 'refs/heads/main'
run: |
echo "BUMP_TYPE=minor" >> $GITHUB_ENV
- if: github.ref != 'refs/heads/main'
run: |
echo "BUMP_TYPE=patch" >> $GITHUB_ENV
- id: bump_version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: ${{ env.BUMP_TYPE }}
- name: Update version of datayoga-core
run: |
cd core
bump2version --current-version 0.0.0 --allow-dirty --new-version "${{ steps.bump_version.outputs.new_tag }}" patch pyproject.toml
- name: Update version of datayoga (CLI)
run: |
cd cli
bump2version --current-version 0.0.0 --allow-dirty --new-version "${{ steps.bump_version.outputs.new_tag }}" patch pyproject.toml
#
# build
#
- name: Build datayoga-core
run: |
cd core
poetry build
- name: Publish datayoga-core package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: core/dist/
- name: "Build CLI"
run: |
cd cli
poetry build
- name: Publish datayoga (CLI) package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: cli/dist/