-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (70 loc) · 2.13 KB
/
Copy pathpublish.yml
File metadata and controls
74 lines (70 loc) · 2.13 KB
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
name: Publish faker2 to PyPI
on:
# Pure-Python publishing is retired: faker2 is now published as the
# Rust wheels by release.yml. Kept for manual use only.
workflow_dispatch:
inputs:
target:
description: "Where to publish"
required: false
jobs:
build:
name: Build distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.11"
- name: Install build tooling
run: python -m pip install --upgrade pip build twine
- name: Run the test suite
run: |
python -m pip install -e .
python -m pip install pytest pytest-mock validators freezegun
python -m pytest tests -q
- name: Build sdist + wheel
run: python -m build
- name: Check metadata
run: python -m twine check dist/*
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
# Trusted Publishing: no API token needed, PyPI verifies this workflow +
# environment via OIDC. Configure the publisher on PyPI with:
# owner: jqueguiner / repo: faker2 / workflow: publish.yml / environment: pypi
environment:
name: pypi
url: https://pypi.org/p/faker2
permissions:
id-token: write
if: github.event_name == 'release' || inputs.target == 'pypi'
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
publish-testpypi:
name: Publish to TestPyPI
needs: build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/faker2
permissions:
id-token: write
if: github.event_name == 'workflow_dispatch' && inputs.target == 'testpypi'
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/