|
1 | | -name: Publish packages to PyPI |
| 1 | +name: Release |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: |
5 | | - push: |
6 | | - tags: |
7 | | - - "[0-9]+.[0-9]+.[0-9]+" |
8 | | - - "[0-9]+.[0-9]+.[0-9]+.post[0-9]+" |
9 | | - - "[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+" |
10 | | - - "[0-9]+.[0-9]+.[0-9]+rc[0-9]+" |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: "The new version to set" |
| 8 | + required: true |
| 9 | + following_version: |
| 10 | + description: "The post (dev) version to set" |
| 11 | + required: true |
| 12 | + dry_run: |
| 13 | + description: "Dry Run?" |
| 14 | + default: false |
| 15 | + type: boolean |
| 16 | + |
| 17 | +env: |
| 18 | + # Changes per repo |
| 19 | + PRODUCT_NAME: pymongo-auth-aws |
| 20 | + # Changes per branch |
| 21 | + SILK_ASSET_GROUP: pymongo-auth-aws |
| 22 | + |
| 23 | +defaults: |
| 24 | + run: |
| 25 | + shell: bash -eux {0} |
11 | 26 |
|
12 | 27 | jobs: |
13 | | - build: |
14 | | - runs-on: ubuntu-latest |
| 28 | + pre-publish: |
15 | 29 | environment: release |
| 30 | + runs-on: ubuntu-latest |
| 31 | + permissions: |
| 32 | + id-token: write |
| 33 | + contents: write |
16 | 34 | steps: |
17 | | - - uses: actions/checkout@v4 |
18 | | - - name: Set up Python |
19 | | - uses: actions/setup-python@v4 |
20 | | - with: |
21 | | - python-version: 3.x |
22 | | - - name: Install dependencies |
23 | | - run: pip install build |
24 | | - - name: Create packages |
25 | | - run: python -m build . |
26 | | - - name: Store package artifacts |
27 | | - uses: actions/upload-artifact@v3 |
28 | | - with: |
29 | | - name: dist |
30 | | - path: dist |
| 35 | + - uses: mongodb-labs/drivers-github-tools/secure-checkout@v2 |
| 36 | + with: |
| 37 | + app_id: ${{ vars.APP_ID }} |
| 38 | + private_key: ${{ secrets.APP_PRIVATE_KEY }} |
| 39 | + - uses: mongodb-labs/drivers-github-tools/setup@v2 |
| 40 | + with: |
| 41 | + aws_role_arn: ${{ secrets.AWS_ROLE_ARN }} |
| 42 | + aws_region_name: ${{ vars.AWS_REGION_NAME }} |
| 43 | + aws_secret_id: ${{ secrets.AWS_SECRET_ID }} |
| 44 | + artifactory_username: ${{ vars.ARTIFACTORY_USERNAME }} |
| 45 | + - uses: mongodb-labs/drivers-github-tools/python/pre-publish@v2 |
| 46 | + with: |
| 47 | + version: ${{ inputs.version }} |
| 48 | + dry_run: ${{ inputs.dry_run }} |
| 49 | + |
| 50 | + build-dist: |
| 51 | + needs: [pre-publish] |
| 52 | + uses: ./.github/workflows/dist.yml |
| 53 | + |
| 54 | + static-scan: |
| 55 | + needs: [pre-publish] |
| 56 | + uses: ./.github/workflows/codeql.yml |
| 57 | + with: |
| 58 | + ref: ${{ inputs.version }} |
31 | 59 |
|
32 | 60 | publish: |
33 | | - needs: build |
34 | | - if: startsWith(github.ref, 'refs/tags/') |
| 61 | + needs: [build-dist, static-scan] |
35 | 62 | runs-on: ubuntu-latest |
36 | 63 | environment: release |
37 | 64 | permissions: |
38 | 65 | id-token: write |
| 66 | + contents: write |
| 67 | + security-events: write |
39 | 68 | steps: |
40 | | - - name: Retrieve package artifacts |
41 | | - uses: actions/download-artifact@v3 |
42 | | - - name: Upload packages |
43 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
| 69 | + - uses: mongodb-labs/drivers-github-tools/secure-checkout@v2 |
| 70 | + with: |
| 71 | + app_id: ${{ vars.APP_ID }} |
| 72 | + private_key: ${{ secrets.APP_PRIVATE_KEY }} |
| 73 | + - uses: mongodb-labs/drivers-github-tools/setup@v2 |
| 74 | + with: |
| 75 | + aws_role_arn: ${{ secrets.AWS_ROLE_ARN }} |
| 76 | + aws_region_name: ${{ vars.AWS_REGION_NAME }} |
| 77 | + aws_secret_id: ${{ secrets.AWS_SECRET_ID }} |
| 78 | + artifactory_username: ${{ vars.ARTIFACTORY_USERNAME }} |
| 79 | + - uses: mongodb-labs/drivers-github-tools/python/publish@v2 |
| 80 | + with: |
| 81 | + version: ${{ inputs.version }} |
| 82 | + following_version: ${{ inputs.following_version }} |
| 83 | + product_name: ${{ env.PRODUCT_NAME }} |
| 84 | + silk_asset_group: ${{ env.SILK_ASSET_GROUP }} |
| 85 | + token: ${{ github.token }} |
| 86 | + dry_run: ${{ inputs.dry_run }} |
0 commit comments