| | name: Pre-Release |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| |
|
| | env: |
| | RELEASE_COMMIT: ${{ github.sha }} |
| |
|
| | on: |
| | workflow_dispatch: |
| | inputs: |
| | skip_code_quality: |
| | description: "Skip tests, linting, and baseline. Only use if release fail for reasons beyond our control and you need a quick release." |
| | default: false |
| | type: boolean |
| | required: false |
| | skip_pypi: |
| | description: "Skip publishing to PyPi. Used for testing release steps." |
| | default: false |
| | type: boolean |
| | required: false |
| | schedule: |
| | |
| | - cron: "0 8 * * 1-5" |
| |
|
| | permissions: |
| | contents: read |
| |
|
| | jobs: |
| |
|
| | |
| | |
| | |
| | |
| | seal: |
| | |
| | if: github.repository == 'aws-powertools/powertools-lambda-python' |
| |
|
| | runs-on: ubuntu-latest |
| | permissions: |
| | contents: read |
| | outputs: |
| | integrity_hash: ${{ steps.seal_source_code.outputs.integrity_hash }} |
| | artifact_name: ${{ steps.seal_source_code.outputs.artifact_name }} |
| | RELEASE_VERSION: ${{ steps.release_version.outputs.RELEASE_VERSION }} |
| | steps: |
| | |
| |
|
| | |
| | - name: Install poetry |
| | run: | |
| | pipx install git+https://github.com/python-poetry/poetry@68b88e5390720a3dd84f02940ec5200bfce39ac6 # v1.5.0 |
| | pipx inject poetry git+https://github.com/monim67/poetry-bumpversion@315fe3324a699fa12ec20e202eb7375d4327d1c4 # v0.3.1 |
| | |
| | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| | with: |
| | ref: ${{ env.RELEASE_COMMIT }} |
| |
|
| | - name: Bump and export release version |
| | id: release_version |
| | run: | |
| | RELEASE_VERSION="$(poetry version prerelease --short | head -n1 | tr -d '\n')" |
| | |
| | echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "$GITHUB_OUTPUT" |
| |
|
| | - name: Verifies pre-release version semantics |
| | |
| | |
| | |
| | |
| | |
| | run: | |
| | if [[ ! "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+[a-b].*$ ]]; then |
| | echo "Version $VERSION doesn't look like a pre-release version; aborting" |
| | exit 1 |
| | fi |
| | env: |
| | RELEASE_VERSION: ${{ steps.release_version.outputs.RELEASE_VERSION}} |
| |
|
| | - name: Seal and upload |
| | id: seal_source_code |
| | uses: ./.github/actions/seal |
| | with: |
| | artifact_name_prefix: "source" |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | quality_check: |
| | needs: seal |
| | runs-on: ubuntu-latest |
| | permissions: |
| | contents: read |
| | steps: |
| | |
| | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| | with: |
| | ref: ${{ env.RELEASE_COMMIT }} |
| |
|
| | - name: Restore sealed source code |
| | uses: ./.github/actions/seal-restore |
| | with: |
| | integrity_hash: ${{ needs.seal.outputs.integrity_hash }} |
| | artifact_name: ${{ needs.seal.outputs.artifact_name }} |
| |
|
| | - name: Debug cache restore |
| | run: cat pyproject.toml |
| |
|
| | - name: Install poetry |
| | run: pipx install git+https://github.com/python-poetry/poetry@68b88e5390720a3dd84f02940ec5200bfce39ac6 |
| | - name: Set up Python |
| | uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b |
| | with: |
| | python-version: "3.12" |
| | cache: "poetry" |
| | - name: Install dependencies |
| | run: make dev |
| | - name: Run all tests, linting and baselines |
| | run: make pr |
| |
|
| | |
| | |
| | |
| | |
| | |
| | build: |
| | runs-on: ubuntu-latest |
| | needs: [quality_check, seal] |
| | permissions: |
| | contents: read |
| | outputs: |
| | integrity_hash: ${{ steps.seal_build.outputs.integrity_hash }} |
| | artifact_name: ${{ steps.seal_build.outputs.artifact_name }} |
| | attestation_hashes: ${{ steps.encoded_hash.outputs.attestation_hashes }} |
| | steps: |
| | |
| | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| | with: |
| | ref: ${{ env.RELEASE_COMMIT }} |
| |
|
| | - name: Restore sealed source code |
| | uses: ./.github/actions/seal-restore |
| | with: |
| | integrity_hash: ${{ needs.seal.outputs.integrity_hash }} |
| | artifact_name: ${{ needs.seal.outputs.artifact_name }} |
| |
|
| | - name: Install poetry |
| | run: pipx install git+https://github.com/python-poetry/poetry@68b88e5390720a3dd84f02940ec5200bfce39ac6 |
| | - name: Set up Python |
| | uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b |
| | with: |
| | python-version: "3.12" |
| | cache: "poetry" |
| |
|
| | - name: Build python package and wheel |
| | run: poetry build |
| |
|
| | - name: Seal and upload |
| | id: seal_build |
| | uses: ./.github/actions/seal |
| | with: |
| | artifact_name_prefix: "build" |
| | files: "dist/" |
| |
|
| | |
| | |
| | - name: Create attestation encoded hash for provenance |
| | id: encoded_hash |
| | working-directory: dist |
| | run: echo "attestation_hashes=$(sha256sum ./* | base64 -w0)" >> "$GITHUB_OUTPUT" |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | provenance: |
| | needs: [seal, build] |
| | permissions: |
| | contents: write |
| | actions: read |
| | id-token: write |
| | |
| | |
| | |
| | uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0 |
| | with: |
| | base64-subjects: ${{ needs.build.outputs.attestation_hashes }} |
| | upload-assets: false |
| |
|
| | |
| | |
| | |
| | |
| | release: |
| | needs: [build, seal, provenance] |
| | environment: pre-release |
| | runs-on: ubuntu-latest |
| | permissions: |
| | id-token: write |
| | env: |
| | RELEASE_VERSION: ${{ needs.seal.outputs.RELEASE_VERSION }} |
| | steps: |
| | |
| | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| | with: |
| | ref: ${{ env.RELEASE_COMMIT }} |
| |
|
| | - name: Restore sealed source code |
| | uses: ./.github/actions/seal-restore |
| | with: |
| | integrity_hash: ${{ needs.build.outputs.integrity_hash }} |
| | artifact_name: ${{ needs.build.outputs.artifact_name }} |
| |
|
| | - name: Upload to PyPi prod |
| | if: ${{ !inputs.skip_pypi }} |
| | uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc |
| |
|
| | |
| | |
| | bump_version: |
| | needs: [release, seal, provenance] |
| | permissions: |
| | contents: write |
| | pull-requests: write |
| | runs-on: ubuntu-latest |
| | steps: |
| | |
| | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| | with: |
| | ref: ${{ env.RELEASE_COMMIT }} |
| |
|
| | - name: Restore sealed source code |
| | uses: ./.github/actions/seal-restore |
| | with: |
| | integrity_hash: ${{ needs.seal.outputs.integrity_hash }} |
| | artifact_name: ${{ needs.seal.outputs.artifact_name }} |
| |
|
| | - name: Download provenance |
| | uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 |
| | with: |
| | name: ${{needs.provenance.outputs.provenance-name}} |
| |
|
| | - name: Update provenance |
| | run: mkdir -p "${PROVENANCE_DIR}" && mv "${PROVENANCE_FILE}" "${PROVENANCE_DIR}/" |
| | env: |
| | PROVENANCE_FILE: ${{ needs.provenance.outputs.provenance-name }} |
| | PROVENANCE_DIR: provenance/${{ needs.seal.outputs.RELEASE_VERSION}} |
| |
|
| | - name: Create PR |
| | id: create-pr |
| | uses: ./.github/actions/create-pr |
| | with: |
| | files: "pyproject.toml aws_lambda_powertools/shared/version.py provenance/" |
| | temp_branch_prefix: "ci-bump" |
| | pull_request_title: "chore(ci): new pre-release ${{ needs.seal.outputs.RELEASE_VERSION }}" |
| | github_token: ${{ secrets.GITHUB_TOKEN }} |
| |
|