1010 branches :
1111 - main
1212
13+ concurrency :
14+ group : ${{ github.workflow }}-${{ github.ref }}
15+ cancel-in-progress : true
16+
1317env :
1418 DOCUMENTATION_CNAME : ' engineeringworkflow.docs.pyansys.com'
1519 MAIN_PYTHON_VERSION : ' 3.13'
1620 PACKAGE_NAME : ' ansys-engineeringworkflow-api'
1721 PACKAGE_NAMESPACE : ' ansys.engineeringworkflow.api'
1822
23+ permissions : {} # Zero permissions can be granted at the workflow level if not all jobs require permissions.
24+ # As a good rule of thumb, this normally includes jobs that don't use secrets.
25+
1926jobs :
27+ check-vulnerabilities :
28+ name : " Check library vulnerabilities"
29+ runs-on : ubuntu-latest
30+ steps :
31+ - uses : ansys/actions/check-vulnerabilities@eb7d0fc873deeee6d4740774675ce1741cb6f154 # v10.2.2
32+ with :
33+ python-version : ${{ env.MAIN_PYTHON_VERSION }}
34+ token : ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
35+ python-package-name : ${{ env.PACKAGE_NAME }}
36+ dev-mode : ${{ github.ref != 'refs/heads/main' }}
37+
38+ actions-security :
39+ name : " Check actions security"
40+ runs-on : ubuntu-latest
41+ steps :
42+ - uses : ansys/actions/check-actions-security@eb7d0fc873deeee6d4740774675ce1741cb6f154 # v10.2.2
43+ with :
44+ generate-summary : true
45+ token : ${{ secrets.GITHUB_TOKEN }}
46+ auditing-level : ' high'
47+ trust-ansys-actions : false
48+
2049 code-style :
2150 name : " Code style"
2251 runs-on : ubuntu-latest
2352 steps :
2453 - name : PyAnsys code style checks
25- uses : ansys/actions/code-style@v8
54+ uses : ansys/actions/code-style@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
2655 with :
2756 python-version : ${{ env.MAIN_PYTHON_VERSION }}
2857
3160 runs-on : ubuntu-latest
3261 steps :
3362 - name : PyAnsys documentation style checks
34- uses : ansys/actions/doc-style@v8
63+ uses : ansys/actions/doc-style@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
3564 with :
3665 token : ${{ secrets.GITHUB_TOKEN }}
3766
5281
5382 steps :
5483 - name : Build wheelhouse and perform smoke test
55- uses : ansys/actions/build-wheelhouse@v8
84+ uses : ansys/actions/build-wheelhouse@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
5685 with :
5786 library-name : ${{ env.PACKAGE_NAME }}
5887 operating-system : ${{ matrix.os }}
@@ -64,18 +93,18 @@ jobs:
6493 needs : [smoke-tests]
6594 steps :
6695 - name : Run pytest
67- uses : ansys/actions/tests-pytest@v8
96+ uses : ansys/actions/tests-pytest@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
6897 with :
6998 python-version : ${{ matrix.python-version }}
7099 pytest-extra-args : -v --durations=10 --maxfail=10 --cov=${{ env.PACKAGE_NAMESPACE }} --cov-report=xml:coverage.xml --cov-report=html --cov-report term
71100
72101 - name : " Upload coverage to Codecov"
73- uses : codecov/codecov-action@v5
102+ uses : codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
74103 with :
75104 files : coverage.xml
76105
77106 - name : " Upload coverage artifacts"
78- uses : actions/upload-artifact@v4
107+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
79108 with :
80109 name : coverage-html
81110 path : htmlcov
96125 runs-on : ubuntu-latest
97126 steps :
98127 - name : Build library source and wheel artifacts
99- uses : ansys/actions/build-library@v8
128+ uses : ansys/actions/build-library@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
100129 with :
101130 library-name : ${{ env.PACKAGE_NAME }}
102131 python-version : ${{ env.MAIN_PYTHON_VERSION }}
@@ -109,39 +138,53 @@ jobs:
109138 needs : [package]
110139 steps :
111140 - name : " Deploy the latest documentation"
112- uses : ansys/actions/doc-deploy-dev@v8
141+ uses : ansys/actions/doc-deploy-dev@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
113142 with :
114143 cname : ${{ env.DOCUMENTATION_CNAME }}
115144 token : ${{ secrets.GITHUB_TOKEN }}
116145
117146 release :
118147 name : " Release project to public PyPI and GitHub"
119- if : github.event_name == 'push' && contains(github.ref, 'refs/tags')
120- needs : [package]
148+ if : ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
149+ needs : [package]
121150 runs-on : ubuntu-latest
151+ # INFO: Specifying a GitHub environment is optional but encouraged
152+ environment : release
153+ # INFO: Trusted publishers require these permissions
154+ permissions :
155+ id-token : write # required by trusted publishers
156+ contents : write # required by trusted publishers
122157 steps :
158+ - name : Download the library artifacts from build-library step
159+ uses : actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
160+ with :
161+ name : ${{ env.PACKAGE_NAME }}-artifacts
162+ path : ${{ env.PACKAGE_NAME }}-artifacts
123163
124- - name : " Release to the public PyPI repository"
125- uses : ansys/actions/release-pypi-public@v8
126- with :
127- library-name : ${{ env.PACKAGE_NAME }}
128- twine-username : " __token__"
129- twine-token : ${{ secrets.PYPI_TOKEN }}
164+ - name : Release to PyPI using trusted publisher
165+ uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
166+ with :
167+ repository-url : " https://upload.pypi.org/legacy/"
168+ print-hash : true
169+ packages-dir : ${{ env.PACKAGE_NAME }}-artifacts
170+ skip-existing : false
130171
131- - name : " Release to GitHub"
132- uses : ansys/actions/release-github@v8
133- with :
134- library-name : ${{ env.PACKAGE_NAME }}
172+ - name : " Release to GitHub"
173+ uses : ansys/actions/release-github@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
174+ with :
175+ library-name : ${{ env.PACKAGE_NAME }}
135176
136177 doc-deploy-stable :
137178 name : " Deploy stable documentation"
138179 # Deploy release documentation when creating a new tag
139180 if : github.event_name == 'push' && contains(github.ref, 'refs/tags')
140181 runs-on : ubuntu-latest
141182 needs : [release]
183+ permissions :
184+ contents : write # Write permissions to deploy the documentation
142185 steps :
143186 - name : " Deploy the stable documentation"
144- uses : ansys/actions/doc-deploy-stable@v8
187+ uses : ansys/actions/doc-deploy-stable@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
145188 with :
146189 cname : ${{ env.DOCUMENTATION_CNAME }}
147190 token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments