33
44name : build
55
6- env :
7- package : codext
8-
96on :
107 push :
118 branches : [ "main" ]
129 pull_request :
1310 branches : [ "main" ]
1411
1512permissions :
13+ actions : write
1614 id-token : write # for OIDC
1715 contents : read
1816
1917jobs :
18+ prepare :
19+ runs-on : ubuntu-latest
20+ outputs :
21+ package : ${{ steps.pkg.outputs.package }}
22+ steps :
23+ - name : Compute package name from the repository's
24+ id : pkg
25+ run : |
26+ name="${GITHUB_REPOSITORY##*/}"
27+ echo "package=${name#python-}" >> $GITHUB_OUTPUT
2028 build :
29+ needs : prepare
2130 runs-on : ${{ matrix.os }}
2231 strategy :
2332 fail-fast : false
2433 matrix :
2534 os : [ubuntu-latest]
2635 python-version : ["3.9", "3.10", "3.11", "3.12", "3.13"]
36+ env :
37+ package : ${{ needs.prepare.outputs.package }}
2738 steps :
28- - uses : actions/checkout@v3
39+ - uses : actions/checkout@v5
2940 - name : Set up Python ${{ matrix.python-version }}
30- uses : actions/setup-python@v4
41+ uses : actions/setup-python@v6
3142 with :
3243 python-version : ${{ matrix.python-version }}
3344 - name : Install ${{ env.package }}
@@ -41,16 +52,18 @@ jobs:
4152 run : |
4253 pytest --cov=$package
4354 coverage :
44- needs : build
55+ needs : [prepare, build]
4556 runs-on : ubuntu-latest
4657 env :
4758 cov_badge_path : docs/coverage.svg
59+ package : ${{ needs.prepare.outputs.package }}
60+ python_version : " 3.13"
4861 steps :
49- - uses : actions/checkout@v3
50- - name : Set up Python ${{ matrix.python-version }}
51- uses : actions/setup-python@v4
62+ - uses : actions/checkout@v5
63+ - name : Set up Python ${{ env.python_version }}
64+ uses : actions/setup-python@v6
5265 with :
53- python-version : " 3.13 "
66+ python-version : ${{ env.python_version }}
5467 - name : Install ${{ env.package }}
5568 run : |
5669 python -m pip install --upgrade pip
6376 pytest --cov=$package --cov-report=xml
6477 genbadge coverage -i coverage.xml -o $cov_badge_path
6578 - name : Verify Changed files
66- uses : tj-actions/verify-changed-files@v17
79+ uses : tj-actions/verify-changed-files@v20
6780 id : changed_files
6881 with :
6982 files : ${{ env.cov_badge_path }}
@@ -78,17 +91,17 @@ jobs:
7891 if : steps.changed_files.outputs.files_changed == 'true'
7992 uses : ad-m/github-push-action@master
8093 with :
81- github_token : ${{ secrets.github_token }}
94+ github_token : ${{ secrets.GITHUB_TOKEN }}
8295 branch : ${{ github.ref }}
8396 deploy :
8497 runs-on : ubuntu-latest
85- needs : coverage
98+ needs : [prepare, coverage]
8699 steps :
87- - uses : actions/checkout@v3
100+ - uses : actions/checkout@v5
88101 with :
89102 fetch-depth : 0
90103 - name : Check for version change
91- uses : dorny/paths-filter@v2
104+ uses : dorny/paths-filter@v4
92105 id : filter
93106 with :
94107 filters : |
@@ -101,7 +114,7 @@ jobs:
101114 awk '{if (match($0,"## Supporters")) exit; print}' README.md > README
102115 mv -f README README.md
103116 - if : steps.filter.outputs.version == 'true'
104- name : Build ${{ env .package }} package
117+ name : Build ${{ needs.prepare.outputs .package }} package
105118 run : python3 -m pip install --upgrade build && python3 -m build
106119 - if : steps.filter.outputs.version == 'true'
107120 name : Publish to PyPI
0 commit comments