Skip to content

Commit 6125da2

Browse files
committed
Add release.yml
1 parent 9ad6a31 commit 6125da2

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_run:
7+
workflows: ["Test"]
8+
types:
9+
- completed
10+
11+
jobs:
12+
pypi-publish:
13+
name: upload release to PyPI
14+
15+
runs-on: ubuntu-latest
16+
# Specifying a GitHub environment is optional, but strongly encouraged
17+
environment: release
18+
permissions:
19+
# IMPORTANT: this permission is mandatory for trusted publishing
20+
id-token: write
21+
22+
steps:
23+
# retrieve your distributions here
24+
- uses: actions/checkout@v3
25+
26+
- name: Set up Python 3.11
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: "3.11"
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install hatch
35+
36+
- name: Build package distributions
37+
run: |
38+
hatch build
39+
40+
- name: Publish package distributions to PyPI
41+
uses: pypa/gh-action-pypi-publish@release/v1

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,13 @@ dev-dependencies = [
6767
[tool.hatch.metadata]
6868
allow-direct-references = true
6969

70+
[tool.hatch.build.targets.sdist]
71+
include = [
72+
"/src",
73+
]
74+
75+
[tool.hatch.build.targets.wheel]
76+
packages = ["src/python_usernames"]
77+
7078
[tool.hatch.version]
7179
path = "src/python_usernames/__about__.py"

0 commit comments

Comments
 (0)