-
Notifications
You must be signed in to change notification settings - Fork 3
82 lines (68 loc) · 2.19 KB
/
release.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
name: Release
on:
release:
types:
- published
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
jobs:
release:
name: Release package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
id: install_python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: "1.8.4"
- name: Setup a local virtual environment (if no poetry.toml file)
working-directory: ./python
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: Restore cached virtualenv
uses: actions/cache/restore@v4
with:
path: ./python/.venv
key:
venv-${{ runner.os }}-${{
steps.install_python.outputs.python-version }}-${{
hashFiles('./python/poetry.lock') }}
- name: Install dependencies (skipped if cache hit, fallback to install)
working-directory: ./python
run: |
poetry install
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$(poetry env info --path)/bin" >> $GITHUB_ENV
- name: Saved cached virtualenv
uses: actions/cache/save@v4
with:
path: ./python/.venv
key:
venv-${{ runner.os }}-${{
steps.install_python.outputs.python-version }}-${{
hashFiles('./python/poetry.lock') }}
- name: Use PyPI API token
working-directory: ./python
run: poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
- name: Build and publish the package
working-directory: ./python
run: poetry publish --build
- name: Upload Python package to GitHub
uses: actions/upload-artifact@v4
with:
path: ./python/dist/
if-no-files-found: error
publish-docs:
name: Publish documentation
permissions:
pages: write
id-token: write
uses: ./.github/workflows/publish-docs.yml