Skip to content

Commit 81fca91

Browse files
authored
Switch to using trusted publishing (#9)
1 parent d38b9d2 commit 81fca91

File tree

1 file changed

+38
-14
lines changed

1 file changed

+38
-14
lines changed

.github/workflows/pythonpublish.yml

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,47 @@ on:
88
types: [published]
99

1010
jobs:
11-
deploy:
11+
build:
12+
name: Build distribution 📦
1213
runs-on: ubuntu-latest
1314

1415
steps:
15-
- uses: actions/checkout@v3.3.0
16+
- uses: actions/checkout@v4
1617
- name: Set up Python
17-
uses: actions/setup-python@v4
18+
uses: actions/setup-python@v5
1819
with:
1920
python-version: "3.x"
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install build twine
24-
- name: Build and publish
25-
env:
26-
TWINE_USERNAME: __token__
27-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
28-
run: |
29-
python -m build
30-
twine upload dist/*
21+
- name: Install pypa/build
22+
run: >-
23+
python3 -m
24+
pip install
25+
build
26+
--user
27+
- name: Build a binary wheel and a source tarball
28+
run: python3 -m build
29+
- name: Store the distribution packages
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: python-package-distributions
33+
path: dist/
34+
35+
deploy:
36+
permissions:
37+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
38+
runs-on: ubuntu-latest
39+
needs:
40+
- build
41+
name: >-
42+
Publish Python 🐍 distribution 📦 to PyPI
43+
environment:
44+
name: release
45+
url: https://pypi.org/p/esphome-dashboard-api
46+
47+
steps:
48+
- name: Download all the dists
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: python-package-distributions
52+
path: dist/
53+
- name: Publish package distributions to PyPI
54+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)