@@ -3,52 +3,64 @@ name: Build
33on :
44 push :
55 tags :
6- - ' v*.*.* '
6+ - ' v[0-9].[0-9]+.[0-9]+ '
77 workflow_dispatch :
88 pull_request :
99
1010concurrency :
11- group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
11+ group : ${{ github.workflow }}-${{ github.ref }}
1212 cancel-in-progress : true
1313
1414jobs :
1515 build_wheels :
1616 name : Build wheels on ${{ matrix.os }}
1717 runs-on : ${{ matrix.os }}
18+ permissions :
19+ contents : read
1820 strategy :
1921 matrix :
2022 # macos-13 is an intel runner, macos-14 is apple silicon
2123 os : [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-14]
2224
2325 steps :
24- - uses : actions/checkout@v4
26+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+ with :
28+ persist-credentials : false
2529
2630 - name : Install uv
27- uses : astral-sh/setup-uv@v6
31+ uses : astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
32+ with :
33+ enable-cache : false
2834
2935 - name : Build wheels
30- uses : pypa/cibuildwheel@v2.23.3
36+ uses : pypa/cibuildwheel@faf86a6ed7efa889faf6996aa23820831055001a # v2.23.3
3137
32- - uses : actions/upload-artifact@v4
38+ - uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3339 with :
3440 name : cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
3541 path : ./wheelhouse/*.whl
3642
3743 build_sdist :
44+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
3845 name : Build sdist
3946 runs-on : ubuntu-latest
47+ permissions :
48+ contents : read
4049 steps :
41- - uses : actions/checkout@v4
50+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
51+ with :
52+ persist-credentials : false
4253
4354 - name : Build sdist
4455 run : pipx run build --sdist
4556
46- - uses : actions/upload-artifact@v4
57+ - uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
4758 with :
4859 name : cibw-sdist
4960 path : dist/*.tar.gz
5061
5162 publish :
63+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
5264 needs : [build_wheels, build_sdist]
5365 environment : pypi
5466 permissions :
@@ -57,33 +69,37 @@ jobs:
5769 runs-on : ubuntu-latest
5870 steps :
5971 - name : Checkout code
60- uses : actions/checkout@v4
72+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6173 with :
6274 fetch-depth : 0 # Required for changelog
75+ persist-credentials : false
6376
64- - uses : actions/download-artifact@v4
77+ - uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
6578 with :
6679 pattern : cibw-*
6780 path : dist
6881 merge-multiple : true
6982
7083 - name : Upload to PyPI
71- if : ${{ startsWith(github.ref, 'refs/tags/') }}
72- uses : pypa/gh-action-pypi-publish@release/v1
84+ uses : pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
7385 with :
7486 skip-existing : true
7587
76- - name : Generate changelog with git-cliff
77- uses : tj-actions/git-cliff@v1
78- with :
79- args : --latest --strip all
80- output : " CHANGELOG.md"
88+ - name : Generate a changelog
89+ shell : bash
90+ run : >-
91+ pipx run git-cliff --config .github/cliff-template.toml
92+ --github-repo "${GH_REPO}"
93+ --github-token "${GH_TOKEN}"
94+ --latest --output "CHANGELOG.md"
95+ env :
96+ GH_TOKEN : ${{ github.token }}
97+ GH_REPO : ${{ github.repository }}
8198
82- - name : Create Github release
83- if : ${{ startsWith(github.ref, 'refs/tags/') }}
84- uses : ncipollo/release-action@v1
85- with :
86- token : ${{ secrets.GITHUB_TOKEN }}
87- bodyFile : " CHANGELOG.md"
88- draft : false
89- prerelease : false
99+
100+ - name : Create Release
101+ shell : bash
102+ run : gh release create "${GH_REF_NAME}" -F "CHANGELOG.md" --fail-on-no-commits
103+ env :
104+ GH_TOKEN : ${{ github.token }}
105+ GH_REF_NAME : ${{ github.ref_name }}
0 commit comments