1717 DOC_BUILD_SYC_VERSION : 25_2
1818 FLUENT_IMAGE_VERSION : " v25.2.0"
1919 SYC_IMAGE_VERSION : " v25.2.0"
20- MAPDL_IMAGE_VERSION : " v25.1-ubuntu"
20+ MAPDL_IMAGE_VERSION : " v25.1-ubuntu-cicd" # TODO: update to 25.2
21+
22+ permissions : {} # Zero permissions can be granted at the workflow level if not all jobs require permissions.
23+ # As a good rule of thumb, this normally includes jobs that don't use secrets.
2124
2225concurrency :
2326 group : ${{ github.workflow }}-${{ github.ref }}
2427 cancel-in-progress : true
2528
2629jobs :
2730
31+ actions-security :
32+ name : " Check actions security"
33+ runs-on : ubuntu-latest
34+ steps :
35+ - uses : ansys/actions/check-actions-security@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
36+ with :
37+ generate-summary : true
38+ token : ${{ secrets.GITHUB_TOKEN }}
39+ auditing-level : ' high'
40+ trust-ansys-actions : true
41+
2842 doc-style :
2943 name : " Documentation style check"
3044 runs-on : ubuntu-latest
3145 steps :
3246 - name : " PySystemCoupling documentation style checks"
33- uses : ansys/actions/doc-style@v10
47+ uses : ansys/actions/doc-style@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
3448 with :
3549 token : ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
3650 vale-version : " 3.4.1"
4054 runs-on : ubuntu-latest
4155 steps :
4256 - name : PyAnsys code style checks
43- uses : ansys/actions/code-style@v10
57+ uses : ansys/actions/code-style@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
4458 with :
4559 python-version : ${{ env.MAIN_PYTHON_VERSION }}
4660
@@ -56,17 +70,18 @@ jobs:
5670
5771 steps :
5872 - name : " Build wheelhouse and perform smoke test"
59- uses : ansys/actions/build-wheelhouse@v10
73+ uses : ansys/actions/build-wheelhouse@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
6074 with :
6175 library-name : ${{ env.PACKAGE_NAME }}
6276 operating-system : ${{ matrix.os }}
6377 python-version : ${{ matrix.python-version }}
6478
79+
6580 check-vulnerabilities :
6681 name : " Check library vulnerabilities"
6782 runs-on : ubuntu-latest
6883 steps :
69- - uses : ansys/actions/check-vulnerabilities@v10.0
84+ - uses : ansys/actions/check-vulnerabilities@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
7085 with :
7186 python-version : ${{ env.MAIN_PYTHON_VERSION }}
7287 token : ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
@@ -75,23 +90,27 @@ jobs:
7590 # upload-reports: True
7691 # hide-log: false
7792
93+
7894 build :
7995 name : Build package, incl. API generation
8096 needs : [smoke-tests]
8197 runs-on : ubuntu-latest
8298
8399 steps :
84- - uses : actions/checkout@v4
100+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
101+ with :
102+ persist-credentials : false
103+
85104 - name : Setup Python
86- uses : actions/setup-python@v5
105+ uses : actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
87106 with :
88107 python-version : ${{ env.MAIN_PYTHON_VERSION }}
89108
90109 - name : Create initial wheel and install
91110 run : make build-install
92111
93112 - name : Login to GitHub Container Registry
94- uses : docker/login-action@v3
113+ uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
95114 with :
96115 registry : ghcr.io
97116 username : ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
@@ -153,14 +172,16 @@ jobs:
153172 runs-on : ubuntu-latest
154173
155174 steps :
156- - uses : actions/checkout@v4
175+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
176+ with :
177+ persist-credentials : false
157178 - name : Setup Python
158- uses : actions/setup-python@v5
179+ uses : actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
159180 with :
160181 python-version : ${{ env.MAIN_PYTHON_VERSION }}
161182
162183 - name : Download package
163- uses : actions/download-artifact@v4
184+ uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
164185 with :
165186 name : ${{ env.PACKAGE_NAME }}-artifacts
166187 path : dist
@@ -171,7 +192,7 @@ jobs:
171192 pip install -q --force-reinstall ${wheel_name}[tests] > /dev/null
172193
173194 - name : Login to GitHub Container Registry
174- uses : docker/login-action@v3
195+ uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
175196 with :
176197 registry : ghcr.io
177198 username : ${{ secrets.GH_USERNAME }}
@@ -229,15 +250,21 @@ jobs:
229250 name : Build Documentation
230251 needs : [doc-style, build]
231252 runs-on : public-ubuntu-latest-8-cores
253+ permissions :
254+ contents : write
255+ packages : read
256+
232257 steps :
233- - uses : actions/checkout@v4
258+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
259+ with :
260+ persist-credentials : false
234261 - name : Setup Python
235- uses : actions/setup-python@v5
262+ uses : actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
236263 with :
237264 python-version : ${{ env.MAIN_PYTHON_VERSION }}
238265
239266 - name : Download package
240- uses : actions/download-artifact@v4
267+ uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
241268 with :
242269 name : ${{ env.PACKAGE_NAME }}-artifacts
243270 path : dist
@@ -248,7 +275,7 @@ jobs:
248275 pip install -q --force-reinstall ${wheel_name}[doc] > /dev/null
249276
250277 - name : Docker Login
251- uses : docker/login-action@v3
278+ uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
252279 with :
253280 registry : ghcr.io
254281 username : ${{ github.actor }}
@@ -299,7 +326,7 @@ jobs:
299326 # extra_mem_top: 30000000
300327
301328 - name : Upload HTML Documentation
302- uses : actions/upload-artifact@v4
329+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
303330 with :
304331 name : documentation-html
305332 path : doc/_build/html
@@ -318,9 +345,11 @@ jobs:
318345 if : github.ref == 'refs/heads/main'
319346 runs-on : ubuntu-latest
320347 needs : [docs]
348+ permissions :
349+ contents : write
321350 steps :
322351 - name : Deploy the latest documentation
323- uses : ansys/actions/doc-deploy-dev@v10
352+ uses : ansys/actions/doc-deploy-dev@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
324353 with :
325354 cname : ${{ env.DOCUMENTATION_CNAME }}
326355 token : ${{ secrets.GITHUB_TOKEN }}
@@ -333,35 +362,30 @@ jobs:
333362 if : github.event_name == 'push' && contains(github.ref, 'refs/tags')
334363 needs : [test, docs]
335364 runs-on : ubuntu-latest
365+ permissions :
366+ id-token : write
336367 steps :
337- - name : Release to the private PyPI repository
338- uses : ansys/actions/release-pypi-private@v10
339- with :
340- library-name : ${{ env.PACKAGE_NAME }}
341- twine-username : " __token__"
342- twine-token : ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
343368
344- - name : " Release to the public PyPI repository "
345- uses : ansys/ actions/release-pypi-public@v10
369+ - name : " Download the library artifacts from build-library step "
370+ uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
346371 with :
347- library-name : ${{ env.PACKAGE_NAME }}
348- twine-username : " __token__"
349- twine-token : ${{ secrets.PYPI_TOKEN }}
350-
351- # TODO: We can't use ansys/actions/release-github as it assumes PDF doc.
352- - name : Set up Python
353- uses : actions/setup-python@v5
354- with :
355- python-version : ${{ env.MAIN_PYTHON_VERSION }}
372+ name : ${{ env.PACKAGE_NAME }}-artifacts
373+ path : ${{ env.PACKAGE_NAME }}-artifacts
356374
357- - uses : actions/checkout@v4
358- - uses : actions/download-artifact@v4
359375
360376 - name : Display structure of downloaded files
361377 run : ls -R
362378
379+ - name : " Upload artifacts to PyPI using trusted publisher"
380+ uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
381+ with :
382+ repository-url : " https://upload.pypi.org/legacy/"
383+ print-hash : true
384+ packages-dir : ${{ env.PACKAGE_NAME }}-artifacts
385+ skip-existing : false
386+
363387 - name : " Release to GitHub"
364- uses : softprops/action-gh-release@v2
388+ uses : softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 # v2.4.1
365389 with :
366390 files : |
367391 ./**/*.whl
@@ -375,7 +399,7 @@ jobs:
375399 needs : [release]
376400 steps :
377401 - name : Deploy the stable documentation
378- uses : ansys/actions/doc-deploy-stable@v10
402+ uses : ansys/actions/doc-deploy-stable@c2fa7c93f6883114e0e643599431b33d29f0b13f # v10.1.4
379403 with :
380404 cname : ${{ env.DOCUMENTATION_CNAME }}
381405 token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments