Skip to content

Commit 9d64114

Browse files
committed
Harden workflow
Add dispatch trigger, limit permissions to read-only. Minor conveniences
1 parent 9a91d08 commit 9d64114

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

.github/workflows/publish.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,40 @@ on:
55
tags:
66
- "v*"
77

8+
# Rerun workflow manually if the publish fails without new tag
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
814
jobs:
915
build:
1016
name: Build distributions
1117
runs-on: ubuntu-latest
1218

1319
steps:
1420
- name: Check out repository
15-
uses: actions/checkout@v4
21+
uses: actions/checkout@v7
22+
with:
23+
persist-credentials: false
1624

1725
- name: Set up Python
18-
uses: actions/setup-python@v5
26+
uses: actions/setup-python@v7
1927
with:
20-
python-version: "3.12"
28+
python-version: "3.x"
2129

2230
- name: Install build
23-
run: python -m pip install build
31+
run: python3 -m pip install --upgrade build
2432

2533
- name: Build distributions
26-
run: python -m build
34+
run: python3 -m build
2735

2836
- name: Upload distributions
29-
uses: actions/upload-artifact@v4
37+
uses: actions/upload-artifact@v7
3038
with:
3139
name: distributions
3240
path: dist/
41+
if-no-files-found: error
3342

3443
publish:
3544
name: Publish to PyPI
@@ -38,13 +47,14 @@ jobs:
3847

3948
environment:
4049
name: release
50+
url: "https://pypi.org/project/python-lsp-ruff"
4151

4252
permissions:
4353
id-token: write
4454

4555
steps:
4656
- name: Download distributions
47-
uses: actions/download-artifact@v4
57+
uses: actions/download-artifact@v8
4858
with:
4959
name: distributions
5060
path: dist/

0 commit comments

Comments
 (0)