@@ -69,10 +69,6 @@ permissions:
6969
7070jobs :
7171
72- # This job bumps the package version to the release version
73- # creates an integrity hash from the source code
74- # uploads the artifact with the integrity hash as the key name
75- # so subsequent jobs can restore from a trusted point in time to prevent tampering
7672 seal :
7773 runs-on : ubuntu-latest
7874 permissions :
@@ -93,37 +89,24 @@ jobs:
9389 with :
9490 ref : ${{ env.RELEASE_COMMIT }}
9591
96- # We use a pinned version of Poetry to be certain it won't modify source code before we create a hash
97- - name : Install poetry
98- run : |
99- pipx install git+https://github.com/python-poetry/poetry@bd500dd3bdfaec3de6894144c9cedb3a9358be84 # v2.0.1
100- pipx inject poetry git+https://github.com/monim67/poetry-bumpversion@348de6f247222e2953d649932426e63492e0a6bf # v0.3.3
92+ - name : Update version in pyproject.toml
93+ run : sed -i 's/^version = ".*"/version = "${{ steps.release_version.outputs.RELEASE_VERSION }}"/' pyproject.toml
10194
102- - name : Bump package version
103- id : versioning
104- run : poetry version "${RELEASE_VERSION}"
105- env :
106- RELEASE_VERSION : ${{ steps.release_version.outputs.RELEASE_VERSION}}
95+ - name : Update version in version.py
96+ run : sed -i 's/^VERSION = ".*"/VERSION = "${{ steps.release_version.outputs.RELEASE_VERSION }}"/' aws_lambda_powertools/shared/version.py
10797
10898 - name : Seal and upload
10999 id : seal_source_code
110100 uses : ./.github/actions/seal
111101 with :
112102 artifact_name_prefix : " source"
113103
114- # This job runs our automated test suite, complexity and security baselines
115- # it ensures previously merged have been tested as part of the pull request process
116- #
117- # NOTE
118- #
119- # we don't upload the artifact after testing to prevent any tampering of our source code dependencies
120104 quality_check :
121105 needs : seal
122106 runs-on : ubuntu-latest
123107 permissions :
124108 contents : read
125109 steps :
126- # NOTE: we need actions/checkout to configure git first (pre-commit hooks in make dev)
127110 - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
128111 with :
129112 ref : ${{ env.RELEASE_COMMIT }}
@@ -137,23 +120,19 @@ jobs:
137120 - name : Debug cache restore
138121 run : cat pyproject.toml
139122
140- - name : Install poetry
141- run : pipx install git+https://github.com/python-poetry/poetry@bd500dd3bdfaec3de6894144c9cedb3a9358be84 # v2.0.1
123+ - name : Install uv
124+ uses : astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
125+ with :
126+ enable-cache : true
142127 - name : Set up Python
143128 uses : actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
144129 with :
145130 python-version : " 3.14"
146- cache : " poetry"
147131 - name : Install dependencies
148132 run : make dev
149133 - name : Run all tests, linting and baselines
150134 run : make pr
151135
152- # This job creates a release artifact (tar.gz, wheel)
153- # it checks out code from release commit for custom actions to work
154- # then restores the sealed source code (overwrites any potential tampering)
155- # it's done separately from release job to enforce least privilege.
156- # We export just the final build artifact for release
157136 build :
158137 runs-on : ubuntu-latest
159138 needs : [quality_check, seal]
@@ -164,7 +143,6 @@ jobs:
164143 artifact_name : ${{ steps.seal_build.outputs.artifact_name }}
165144 attestation_hashes : ${{ steps.encoded_hash.outputs.attestation_hashes }}
166145 steps :
167- # NOTE: we need actions/checkout to configure git first (pre-commit hooks in make dev)
168146 - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
169147 with :
170148 ref : ${{ env.RELEASE_COMMIT }}
@@ -175,16 +153,17 @@ jobs:
175153 integrity_hash : ${{ needs.seal.outputs.integrity_hash }}
176154 artifact_name : ${{ needs.seal.outputs.artifact_name }}
177155
178- - name : Install poetry
179- run : pipx install git+https://github.com/python-poetry/poetry@bd500dd3bdfaec3de6894144c9cedb3a9358be84 # v2.0.1
156+ - name : Install uv
157+ uses : astral-sh/setup-uv@6b9c6063abd6010835644d4c2e1bef4cf5cd0fca # v6.0.1
158+ with :
159+ enable-cache : true
180160 - name : Set up Python
181161 uses : actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
182162 with :
183163 python-version : " 3.14"
184- cache : " poetry"
185164
186165 - name : Build python package and wheel
187- run : poetry build
166+ run : uv build
188167
189168 - name : Seal and upload
190169 id : seal_build
@@ -193,47 +172,31 @@ jobs:
193172 artifact_name_prefix : " build"
194173 files : " dist/"
195174
196- # NOTE: SLSA retraces our build to its artifact to ensure it wasn't tampered
197- # coupled with GitHub OIDC, SLSA can then confidently sign it came from this release pipeline+commit+branch+org+repo+actor+integrity hash
198175 - name : Create attestation encoded hash for provenance
199176 id : encoded_hash
200177 working-directory : dist
201178 run : echo "attestation_hashes=$(sha256sum ./* | base64 -w0)" >> "$GITHUB_OUTPUT"
202179
203- # This job creates a provenance file that describes how our release was built (all steps)
204- # after it verifies our build is reproducible within the same pipeline
205- # it confirms that its own software and the CI build haven't been tampered with (Trust but verify)
206- # lastly, it creates and sign an attestation (multiple.intoto.jsonl) that confirms
207- # this build artifact came from this GitHub org, branch, actor, commit ID, inputs that triggered this pipeline, and matches its integrity hash
208- # NOTE: supply chain threats review (we protect against all of them now): https://slsa.dev/spec/v1.0/threats-overview
209180 provenance :
210181 needs : [seal, build]
211182 permissions :
212- contents : write # nested job explicitly require despite upload assets being set to false
213- actions : read # To read the workflow path.
214- id-token : write # To sign the provenance.
215- # NOTE: provenance fails if we use action pinning... it's a Github limitation
216- # because SLSA needs to trace & attest it came from a given branch; pinning doesn't expose that information
217- # https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/generic/README.md#referencing-the-slsa-generator
183+ contents : write
184+ actions : read
185+ id-token : write
218186 uses : slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0
219187 with :
220188 base64-subjects : ${{ needs.build.outputs.attestation_hashes }}
221- upload-assets : false # we upload its attestation in create_tag job, otherwise it creates a new release
189+ upload-assets : false
222190
223- # This job uses release artifact to publish to PyPi
224- # it exchanges JWT tokens with GitHub to obtain PyPi credentials
225- # since it's already registered as a Trusted Publisher.
226- # It uses the sealed build artifact (.whl, .tar.gz) to release it
227191 release :
228192 needs : [build, seal, provenance]
229193 environment : release
230194 runs-on : ubuntu-latest
231195 permissions :
232- id-token : write # OIDC for PyPi Trusted Publisher feature
196+ id-token : write
233197 env :
234198 RELEASE_VERSION : ${{ needs.seal.outputs.RELEASE_VERSION }}
235199 steps :
236- # NOTE: we need actions/checkout in order to use our local actions (e.g., ./.github/actions)
237200 - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
238201 with :
239202 ref : ${{ env.RELEASE_COMMIT }}
@@ -248,26 +211,12 @@ jobs:
248211 if : ${{ !inputs.skip_pypi }}
249212 uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
250213
251- # PyPi test maintenance affected us numerous times, leaving for history purposes
252- # - name: Upload to PyPi test
253- # if: ${{ !inputs.skip_pypi }}
254- # uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
255- # with:
256- # repository-url: https://test.pypi.org/legacy/
257-
258- # We create a Git Tag using our release version (e.g., v3.16.0)
259- # using our sealed source code we created earlier.
260- # Because we bumped version of our project as part of CI
261- # we need to add this into git before pushing the tag
262- # otherwise the release commit will be used as the basis for the tag.
263- # Later, we create a PR to update trunk with our newest release version (e.g., bump_version job)
264214 create_tag :
265215 needs : [release, seal, provenance]
266216 runs-on : ubuntu-latest
267217 permissions :
268218 contents : write
269219 steps :
270- # NOTE: we need actions/checkout to authenticate and configure git first
271220 - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
272221 with :
273222 ref : ${{ env.RELEASE_COMMIT }}
@@ -302,16 +251,13 @@ jobs:
302251 provenance_name : ${{needs.provenance.outputs.provenance-name}}
303252 github_token : ${{ secrets.GITHUB_TOKEN }}
304253
305- # Creates a PR with the latest version we've just released
306- # since our trunk is protected against any direct pushes from automation
307254 bump_version :
308255 needs : [release, seal]
309256 permissions :
310- contents : write # create-pr action creates a temporary branch
311- pull-requests : write # create-pr action creates a PR using the temporary branch
257+ contents : write
258+ pull-requests : write
312259 runs-on : ubuntu-latest
313260 steps :
314- # NOTE: we need actions/checkout to authenticate and configure git first
315261 - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
316262 with :
317263 ref : ${{ env.RELEASE_COMMIT }}
@@ -331,15 +277,6 @@ jobs:
331277 pull_request_title : " chore(ci): bump version to ${{ needs.seal.outputs.RELEASE_VERSION }}"
332278 github_token : ${{ secrets.GITHUB_TOKEN }}
333279
334- # This job compiles a Lambda Layer optimized for space and speed (e.g., Cython)
335- # It then deploys to Layer's Beta and Prod account, including SAR Beta and Prod account.
336- # It uses canaries to attest Layers can be used and imported between stages.
337- # Lastly, it updates our documentation with the latest Layer ARN for all regions
338- #
339- # NOTE
340- #
341- # Watch out for the depth limit of 4 nested workflow_calls.
342- # publish_layer -> publish_3_layer -> reusable_deploy_v3_layer_stack
343280 publish_layer :
344281 needs : [seal, release, create_tag]
345282 secrets : inherit
0 commit comments