-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (60 loc) · 1.93 KB
/
poetry-test-publish.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
# Workflow following resources at:
# - https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-pypi
# - https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives
# Jobs are split to prevent unneccessary priviledge elevation through write permissions during building.
name: Build and publish on Pypi Test
on:
workflow_dispatch:
permissions:
contents: read
jobs:
run-tests:
uses: ./.github/workflows/poetry-pytest.yml
secrets: inherit
test-build:
name: Build python wheels
needs:
- run-tests
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- uses: actions/checkout@v4
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@v5.1.1
with:
python-version: "3.12"
- name: Install Poetry
run: |
pip install poetry
- name: Build source and wheel archives
run: poetry build
- name: Upload distributions
# https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v4
with:
name: test-dists
path: dist/
pypi-test-publish:
name: Upload release to PyPI Test
needs:
- test-build
runs-on: ubuntu-latest
environment:
name: test-pypi
url: https://test.pypi.org/p/gimie
permissions:
id-token: write
# IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Retrieve release distributions
# https://github.com/actions/download-artifact
uses: actions/download-artifact@v4.1.8
with:
name: test-dists
path: dist/
- name: Publish package distributions to TestPyPI
# https://github.com/pypa/gh-action-pypi-publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/