1616 PACKAGE_NAME : ' ansys-engineeringworkflow-api'
1717 PACKAGE_NAMESPACE : ' ansys.engineeringworkflow.api'
1818
19+ permissions : {} # Zero permissions can be granted at the workflow level if not all jobs require permissions.
20+ # As a good rule of thumb, this normally includes jobs that don't use secrets.
21+
1922jobs :
23+ check-vulnerabilities :
24+ name : " Check library vulnerabilities"
25+ runs-on : ubuntu-latest
26+ steps :
27+ - uses : ansys/actions/check-vulnerabilities@eb7d0fc873deeee6d4740774675ce1741cb6f154 # v10.2.2
28+ with :
29+ python-version : ${{ env.MAIN_PYTHON_VERSION }}
30+ token : ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
31+ python-package-name : ${{ env.PACKAGE_NAME }}
32+ dev-mode : ${{ github.ref != 'refs/heads/main' }}
33+
34+ actions-security :
35+ name : " Check actions security"
36+ runs-on : ubuntu-latest
37+ steps :
38+ - uses : ansys/actions/check-actions-security@eb7d0fc873deeee6d4740774675ce1741cb6f154 # v10.2.2
39+ with :
40+ generate-summary : true
41+ token : ${{ secrets.GITHUB_TOKEN }}
42+ auditing-level : ' high'
43+ trust-ansys-actions : false
44+
2045 code-style :
2146 name : " Code style"
2247 runs-on : ubuntu-latest
2348 steps :
2449 - name : PyAnsys code style checks
25- uses : ansys/actions/code-style@v8
50+ uses : ansys/actions/code-style@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
2651 with :
2752 python-version : ${{ env.MAIN_PYTHON_VERSION }}
2853
3156 runs-on : ubuntu-latest
3257 steps :
3358 - name : PyAnsys documentation style checks
34- uses : ansys/actions/doc-style@v8
59+ uses : ansys/actions/doc-style@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
3560 with :
3661 token : ${{ secrets.GITHUB_TOKEN }}
3762
5277
5378 steps :
5479 - name : Build wheelhouse and perform smoke test
55- uses : ansys/actions/build-wheelhouse@v8
80+ uses : ansys/actions/build-wheelhouse@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
5681 with :
5782 library-name : ${{ env.PACKAGE_NAME }}
5883 operating-system : ${{ matrix.os }}
@@ -64,18 +89,18 @@ jobs:
6489 needs : [smoke-tests]
6590 steps :
6691 - name : Run pytest
67- uses : ansys/actions/tests-pytest@v8
92+ uses : ansys/actions/tests-pytest@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
6893 with :
6994 python-version : ${{ matrix.python-version }}
7095 pytest-extra-args : -v --durations=10 --maxfail=10 --cov=${{ env.PACKAGE_NAMESPACE }} --cov-report=xml:coverage.xml --cov-report=html --cov-report term
7196
7297 - name : " Upload coverage to Codecov"
73- uses : codecov/codecov-action@v5
98+ uses : codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
7499 with :
75100 files : coverage.xml
76101
77102 - name : " Upload coverage artifacts"
78- uses : actions/upload-artifact@v4
103+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
79104 with :
80105 name : coverage-html
81106 path : htmlcov
96121 runs-on : ubuntu-latest
97122 steps :
98123 - name : Build library source and wheel artifacts
99- uses : ansys/actions/build-library@v8
124+ uses : ansys/actions/build-library@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
100125 with :
101126 library-name : ${{ env.PACKAGE_NAME }}
102127 python-version : ${{ env.MAIN_PYTHON_VERSION }}
@@ -109,39 +134,53 @@ jobs:
109134 needs : [package]
110135 steps :
111136 - name : " Deploy the latest documentation"
112- uses : ansys/actions/doc-deploy-dev@v8
137+ uses : ansys/actions/doc-deploy-dev@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
113138 with :
114139 cname : ${{ env.DOCUMENTATION_CNAME }}
115140 token : ${{ secrets.GITHUB_TOKEN }}
116141
117142 release :
118143 name : " Release project to public PyPI and GitHub"
119- if : github.event_name == 'push' && contains(github.ref, 'refs/tags')
120- needs : [package]
144+ if : ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
145+ needs : [package]
121146 runs-on : ubuntu-latest
147+ # INFO: Specifying a GitHub environment is optional but encouraged
148+ environment : release
149+ # INFO: Trusted publishers require these permissions
150+ permissions :
151+ id-token : write # required by trusted publishers
152+ contents : write # required by trusted publishers
122153 steps :
154+ - name : Download the library artifacts from build-library step
155+ uses : actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
156+ with :
157+ name : ${{ env.PACKAGE_NAME }}-artifacts
158+ path : ${{ env.PACKAGE_NAME }}-artifacts
123159
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 }}
160+ - name : Release to PyPI using trusted publisher
161+ uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
162+ with :
163+ repository-url : " https://upload.pypi.org/legacy/"
164+ print-hash : true
165+ packages-dir : ${{ env.PACKAGE_NAME }}-artifacts
166+ skip-existing : false
130167
131- - name : " Release to GitHub"
132- uses : ansys/actions/release-github@v8
133- with :
134- library-name : ${{ env.PACKAGE_NAME }}
168+ - name : " Release to GitHub"
169+ uses : ansys/actions/release-github@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
170+ with :
171+ library-name : ${{ env.PACKAGE_NAME }}
135172
136173 doc-deploy-stable :
137174 name : " Deploy stable documentation"
138175 # Deploy release documentation when creating a new tag
139176 if : github.event_name == 'push' && contains(github.ref, 'refs/tags')
140177 runs-on : ubuntu-latest
141178 needs : [release]
179+ permissions :
180+ contents : write # Write permissions to deploy the documentation
142181 steps :
143182 - name : " Deploy the stable documentation"
144- uses : ansys/actions/doc-deploy-stable@v8
183+ uses : ansys/actions/doc-deploy-stable@010ddbe522e0a9aed3cbd850b4e226dcfae4ecda # v8.2.30
145184 with :
146185 cname : ${{ env.DOCUMENTATION_CNAME }}
147186 token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments