Skip to content

Commit 72fc566

Browse files
PYTHON-4418 SSDLC Conformance (#31)
Signed-off-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com> Co-authored-by: mongodb-dbx-release-bot[bot] <167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com>
1 parent c56a884 commit 72fc566

File tree

4 files changed

+111
-29
lines changed

4 files changed

+111
-29
lines changed

.github/workflows/codeql.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ on:
1818
branches: [ "master", "*" ]
1919
schedule:
2020
- cron: '35 23 * * 5'
21+
workflow_call:
22+
inputs:
23+
ref:
24+
required: true
25+
type: string
2126

2227
jobs:
2328
analyze:
@@ -35,6 +40,8 @@ jobs:
3540
steps:
3641
- name: Checkout repository
3742
uses: actions/checkout@v4
43+
with:
44+
ref: ${{ inputs.ref }}
3845
- name: Set up Python
3946
uses: actions/setup-python@v4
4047
with:

.github/workflows/dist.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Python Dist
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
push:
7+
tags:
8+
- "[0-9]+.[0-9]+.[0-9]+"
9+
- "[0-9]+.[0-9]+.[0-9]+.post[0-9]+"
10+
- "[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+"
11+
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
environment: release
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: 3.x
23+
- name: Install dependencies
24+
run: pip install build
25+
- name: Create packages
26+
run: python -m build .
27+
- name: Store package artifacts
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: all-dist-${{ github.run_id }}
31+
path: "dist/*"
Lines changed: 72 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,86 @@
1-
name: Publish packages to PyPI
1+
name: Release
22

33
on:
44
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}
1126

1227
jobs:
13-
build:
14-
runs-on: ubuntu-latest
28+
pre-publish:
1529
environment: release
30+
runs-on: ubuntu-latest
31+
permissions:
32+
id-token: write
33+
contents: write
1634
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 }}
3159

3260
publish:
33-
needs: build
34-
if: startsWith(github.ref, 'refs/tags/')
61+
needs: [build-dist, static-scan]
3562
runs-on: ubuntu-latest
3663
environment: release
3764
permissions:
3865
id-token: write
66+
contents: write
67+
security-events: write
3968
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 }}

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Homepage = "https://github.com/mongodb/pymongo-auth-aws"
4242

4343
[tool.hatch.version]
4444
path = "pymongo_auth_aws/version.py"
45+
validate-bump = false
4546

4647
[tool.hatch.metadata.hooks.requirements_txt]
4748
files = ["requirements.txt"]

0 commit comments

Comments
 (0)