-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (51 loc) · 1.59 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
name: CI
on:
push:
branches:
- main
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "poetry"
- run: |
poetry update --with=dev
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
- run: pytest
- id: check_version
run: python .github/workflows/check_version.py
- id: build
if: steps.check_version.outputs.new_version != ''
run: poetry build
- id: pump
if: steps.build.conclusion == 'success'
run: |
git config --global user.email "hoishing@gmail.com"
git config --global user.name "Kelvin Ng"
git tag ${{ steps.check_version.outputs.new_version }}
git push --tag -f
- id: release
if: steps.pump.conclusion == 'success'
run: |
latest_tag=${{ steps.check_version.outputs.new_version }}
echo ${{ secrets.GH_TOKEN }} | gh auth login --with-token
gh release create "$latest_tag" --generate-notes ./dist/*
- id: publish
if: steps.release.conclusion == 'success'
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
poetry publish
- id: deploy_docs
if: steps.publish.conclusion == 'success'
run: mkdocs gh-deploy --force