-
Notifications
You must be signed in to change notification settings - Fork 53
94 lines (81 loc) · 2.83 KB
/
release_py.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Embedbase python SDK release
on:
push:
branches:
- main
- next
- rc
paths:
- "sdk/embedbase-py/**"
# when pyproject.toml changes
- "pyproject.toml"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- uses: actions-ecosystem/action-regex-match@v2
id: regex-match
with:
text: ${{ github.event.head_commit.message }}
regex: "^Release sdk-py ([^ ]+)"
- name: Install Poetry
if: ${{ steps.regex-match.outputs.match != '' }}
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Set up cache
if: ${{ steps.regex-match.outputs.match != '' }}
uses: actions/cache@v2.1.6
with:
path: sdk/embedbase-py/.venv
key: venv-${{ matrix.python-version }}-${{ hashFiles('sdk/embedbase-py/pyproject.toml') }}-${{ hashFiles('sdk/embedbase-py/poetry.lock') }}
- name: Install dependencies
if: ${{ steps.regex-match.outputs.match != '' }}
run: |
poetry config virtualenvs.in-project true
poetry install
working-directory: sdk/embedbase-py
- name: Run tests
if: ${{ steps.regex-match.outputs.match != '' }}
run: |
make test
env:
EMBEDBASE_API_KEY: ${{ secrets.EMBEDBASE_API_KEY }}
# necessary hack otherwise ci running in parallel create concurrency issues
EMBEDBASE_DATASET: release_sdk_py_unit_test
BANKRUPT_EMBEDBASE_KEY: ${{ secrets.BANKRUPT_EMBEDBASE_KEY }}
working-directory: sdk/embedbase-py
- name: Build package
if: ${{ steps.regex-match.outputs.match != '' }}
run: |
poetry build
working-directory: sdk/embedbase-py
- name: Publish to PyPI
if: ${{ steps.regex-match.outputs.match != '' }}
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
poetry publish
working-directory: sdk/embedbase-py
- uses: rickstaa/action-create-tag@v1
if: ${{ steps.regex-match.outputs.match != '' }}
id: "tag_create"
with:
tag: sdk-py-${{ steps.regex-match.outputs.group1 }}
tag_exists_error: true
message: "Release ${{ steps.regex-match.outputs.group1 }}"
- name: Create Release
if: ${{ steps.regex-match.outputs.match != '' }}
uses: softprops/action-gh-release@v1
with:
tag_name: sdk-py-${{ steps.regex-match.outputs.group1 }}
name: sdk-py-${{ steps.regex-match.outputs.group1 }}
draft: false
prerelease: false