File tree Expand file tree Collapse file tree 7 files changed +74
-47
lines changed Expand file tree Collapse file tree 7 files changed +74
-47
lines changed Original file line number Diff line number Diff line change @@ -133,8 +133,7 @@ Admin credentials are needed to access the setup.
133
133
134
134
- needs admin rights
135
135
- we are using [ semver] ( https://semver.org/ ) (see section on versioning)
136
- - we are using [ GitHub Actions to deploy] ( ./workflows/python_publish.yml )
137
- - PyPi credentials are stored as GitHub secrets
136
+ - we are using [ GitHub Actions to deploy] ( ./workflows/release.yml )
138
137
139
138
Follow this workflow:
140
139
Original file line number Diff line number Diff line change 28
28
- name : Update pip et al.
29
29
run : |
30
30
python -m pip install --upgrade pip
31
- python -m pip install --upgrade build
31
+ python -m pip install --upgrade build twine
32
32
33
33
- uses : actions/checkout@v4
34
34
with :
37
37
submodules : true
38
38
- name : Build sdist
39
39
run : python -m build --sdist
40
+ - name : Check sdist
41
+ run : twine check --strict dist/*
40
42
- name : Install sdist
41
43
run : pip install ./dist/pyprep-*
42
44
- name : Clean up working directory
53
55
submodules : true
54
56
- name : Build wheel
55
57
run : python -m build --wheel
58
+ - name : Check wheel
59
+ run : twine check --strict dist/*
56
60
- name : Install wheel
57
61
run : pip install ./dist/pyprep-*.whl
58
62
- name : Clean up working directory
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 63
63
- name : Check formatting
64
64
if : matrix.platform == 'ubuntu-latest'
65
65
run : |
66
- flake8 --docstring-convention numpy .
67
66
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
68
67
69
68
- name : Test with pytest
Original file line number Diff line number Diff line change
1
+ # Upload a Python Package using Twine when a release is created
2
+
3
+ name : build
4
+ on : # yamllint disable-line rule:truthy
5
+ release :
6
+ types : [published]
7
+ push :
8
+ branches :
9
+ - main
10
+ pull_request :
11
+ branches :
12
+ - main
13
+
14
+ permissions :
15
+ contents : read
16
+
17
+ jobs :
18
+ package :
19
+ runs-on : ubuntu-latest
20
+ steps :
21
+ - uses : actions/checkout@v4
22
+ - uses : actions/setup-python@v5
23
+ with :
24
+ python-version : ' 3.12'
25
+ - name : Install dependencies
26
+ run : |
27
+ python -m pip install --upgrade pip
28
+ python -m pip install build twine
29
+ - run : python -m build --sdist --wheel
30
+ - run : twine check --strict dist/*
31
+ - uses : actions/upload-artifact@v4
32
+ with :
33
+ name : dist
34
+ path : dist
35
+
36
+ pypi-upload :
37
+ needs : package
38
+ runs-on : ubuntu-latest
39
+ if : github.event_name == 'release'
40
+ permissions :
41
+ id-token : write # for trusted publishing
42
+ environment :
43
+ name : pypi
44
+ url : https://pypi.org/p/pyprep
45
+ steps :
46
+ - uses : actions/download-artifact@v4
47
+ with :
48
+ name : dist
49
+ path : dist
50
+ - uses : pypa/gh-action-pypi-publish@release/v1
51
+ if : github.event_name == 'release'
Original file line number Diff line number Diff line change 1
1
# See https://pre-commit.com for more information
2
2
# See https://pre-commit.com/hooks.html for more hooks
3
3
repos :
4
- - repo : https://github.com/pre-commit/pre-commit-hooks
4
+ - repo : https://github.com/pre-commit/pre-commit-hooks
5
5
rev : v4.6.0
6
6
hooks :
7
- - id : trailing-whitespace
8
- - id : end-of-file-fixer
9
- - id : check-yaml
10
- - id : check-json
11
- - id : check-ast
12
- - id : check-added-large-files
13
- - id : check-case-conflict
14
- - id : check-docstring-first
7
+ - id : trailing-whitespace
8
+ - id : end-of-file-fixer
9
+ - id : check-yaml
10
+ - id : check-json
11
+ - id : check-ast
12
+ - id : check-added-large-files
13
+ - id : check-case-conflict
14
+ - id : check-docstring-first
15
+
16
+ - repo : https://github.com/astral-sh/ruff-pre-commit
17
+ rev : v0.6.2
18
+ hooks :
19
+ - id : ruff
20
+ args : ["--fix"]
21
+ - id : ruff-format
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ dependencies = [
54
54
# Dependencies for running the test infrastructure
55
55
test = [
56
56
" build" ,
57
+ " twine" ,
57
58
" ruff" ,
58
59
" isort" ,
59
60
" matplotlib" ,
You can’t perform that action at this time.
0 commit comments