-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (97 loc) · 3.3 KB
/
ci.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Continuous Integration
on:
push:
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.11']
name: Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- run: pip install -r dev-requirements.txt
- run: nox -p ${{ matrix.python-version }}
deploy-vnext:
runs-on: ubuntu-latest
needs: tests
if: github.ref == 'refs/heads/main'
env:
NODE_ENV: production
steps:
- uses: actions/checkout@main
- name: Set up Python 3.11
uses: actions/setup-python@main
with:
python-version: '3.11'
architecture: x64
- name: Install dependencies
run: |
pip install -r dev-requirements.txt
poetry install
- name: Generate version
id: pkg-info
run: |
git clone --bare ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} ../metadata
pushd ../metadata
latestTag=$(git rev-list --tags --max-count=1)
firstCommit=$(git rev-list --max-parents=0 HEAD)
build="$(git rev-list --count ${latestTag:=${firstCommit}}..HEAD)"
popd
setupVer=$(grep "version = " pyproject.toml | cut -d' ' -f3 | sed "s/\"//g")
version="${setupVer}-dev${build}"
echo ::set-output name=setup_version::${setupVer}
echo ::set-output name=version::${version}
- name: Prep pyproject.toml for release
env:
SETUP_VERSION: ${{ steps.pkg-info.outputs.setup_version }}
PKG_VERSION: ${{ steps.pkg-info.outputs.version }}
run: |
sed -i "s/version = \"${SETUP_VERSION}\"/version = \"${PKG_VERSION}\"/" ./pyproject.toml
- name: Build library package
run: poetry build
- name: Deploy to pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
deploy-latest:
runs-on: ubuntu-latest
needs: tests
if: startsWith(github.ref, 'refs/tags/v')
env:
NODE_ENV: production
steps:
- uses: actions/checkout@main
- name: Set up Python 3.11
uses: actions/setup-python@main
with:
python-version: '3.11'
architecture: x64
- name: Install dependencies
run: |
pip install -r dev-requirements.txt
poetry install
- name: Generate version
id: pkg-info
run: |
setupVer=$(grep "version = " pyproject.toml | cut -d' ' -f3 | sed "s/\"//g")
echo ::set-output name=setup_version::${setupVer}
echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
- name: Prep pyproject.toml for release
env:
SETUP_VERSION: ${{ steps.pkg-info.outputs.setup_version }}
PKG_VERSION: ${{ steps.pkg-info.outputs.version }}
run: |
sed -i "s/version = \"${SETUP_VERSION}\"/version = \"${PKG_VERSION}\"/" ./pyproject.toml
- name: Build library package
run: poetry build
- name: Deploy to pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}