atlas-local-lib-py 0.1.0a0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. atlas_local_lib_py-0.1.0a0/.github/dependabot.yml +67 -0
  2. atlas_local_lib_py-0.1.0a0/.github/pull_request_template.md +51 -0
  3. atlas_local_lib_py-0.1.0a0/.github/workflows/check-pr-title.yml +29 -0
  4. atlas_local_lib_py-0.1.0a0/.github/workflows/close-jira.yaml +17 -0
  5. atlas_local_lib_py-0.1.0a0/.github/workflows/create-jira.yaml +17 -0
  6. atlas_local_lib_py-0.1.0a0/.github/workflows/dependabot-auto-merge.yaml +36 -0
  7. atlas_local_lib_py-0.1.0a0/.github/workflows/dependabot-jira.yaml +17 -0
  8. atlas_local_lib_py-0.1.0a0/.github/workflows/dependabot-licenses.yml +108 -0
  9. atlas_local_lib_py-0.1.0a0/.github/workflows/issue-closed.yaml +16 -0
  10. atlas_local_lib_py-0.1.0a0/.github/workflows/issue-opened.yaml +16 -0
  11. atlas_local_lib_py-0.1.0a0/.github/workflows/issue-reopened.yaml +16 -0
  12. atlas_local_lib_py-0.1.0a0/.github/workflows/license.yml +76 -0
  13. atlas_local_lib_py-0.1.0a0/.github/workflows/prepare-release.yml +102 -0
  14. atlas_local_lib_py-0.1.0a0/.github/workflows/release.yml +144 -0
  15. atlas_local_lib_py-0.1.0a0/.github/workflows/test.yml +146 -0
  16. atlas_local_lib_py-0.1.0a0/.gitignore +73 -0
  17. atlas_local_lib_py-0.1.0a0/CHANGELOG.md +36 -0
  18. atlas_local_lib_py-0.1.0a0/CONTRIBUTING.md +156 -0
  19. atlas_local_lib_py-0.1.0a0/Cargo.lock +1281 -0
  20. atlas_local_lib_py-0.1.0a0/Cargo.toml +20 -0
  21. atlas_local_lib_py-0.1.0a0/LICENSE-3RD-PARTY.txt +4131 -0
  22. atlas_local_lib_py-0.1.0a0/LICENSE.txt +202 -0
  23. atlas_local_lib_py-0.1.0a0/PKG-INFO +115 -0
  24. atlas_local_lib_py-0.1.0a0/README.md +94 -0
  25. atlas_local_lib_py-0.1.0a0/about.hbs +22 -0
  26. atlas_local_lib_py-0.1.0a0/about.toml +13 -0
  27. atlas_local_lib_py-0.1.0a0/cliff.toml +87 -0
  28. atlas_local_lib_py-0.1.0a0/deny.toml +239 -0
  29. atlas_local_lib_py-0.1.0a0/examples/01_quickstart.ipynb +314 -0
  30. atlas_local_lib_py-0.1.0a0/examples/02_deployment_lifecycle.ipynb +326 -0
  31. atlas_local_lib_py-0.1.0a0/examples/03_error_handling.ipynb +374 -0
  32. atlas_local_lib_py-0.1.0a0/pyproject.toml +37 -0
  33. atlas_local_lib_py-0.1.0a0/scripts/check-python-licenses.sh +35 -0
  34. atlas_local_lib_py-0.1.0a0/scripts/generate-third-party.sh +64 -0
  35. atlas_local_lib_py-0.1.0a0/scripts/py_runtime_deps.py +55 -0
  36. atlas_local_lib_py-0.1.0a0/src/connection_string.rs +24 -0
  37. atlas_local_lib_py-0.1.0a0/src/create.rs +73 -0
  38. atlas_local_lib_py-0.1.0a0/src/create_deployment_options.rs +340 -0
  39. atlas_local_lib_py-0.1.0a0/src/delete.rs +24 -0
  40. atlas_local_lib_py-0.1.0a0/src/deployment.rs +126 -0
  41. atlas_local_lib_py-0.1.0a0/src/exceptions.rs +551 -0
  42. atlas_local_lib_py-0.1.0a0/src/get.rs +17 -0
  43. atlas_local_lib_py-0.1.0a0/src/get_or_create.rs +148 -0
  44. atlas_local_lib_py-0.1.0a0/src/lib.rs +31 -0
  45. atlas_local_lib_py-0.1.0a0/src/list.rs +21 -0
  46. atlas_local_lib_py-0.1.0a0/src/logs.rs +197 -0
  47. atlas_local_lib_py-0.1.0a0/src/option_conflicts.rs +325 -0
  48. atlas_local_lib_py-0.1.0a0/src/pause.rs +24 -0
  49. atlas_local_lib_py-0.1.0a0/src/runtime.rs +72 -0
  50. atlas_local_lib_py-0.1.0a0/src/start.rs +111 -0
  51. atlas_local_lib_py-0.1.0a0/src/stop.rs +24 -0
  52. atlas_local_lib_py-0.1.0a0/src/unpause.rs +24 -0
  53. atlas_local_lib_py-0.1.0a0/tests/test_create.py +17 -0
  54. atlas_local_lib_py-0.1.0a0/tests/test_exceptions.py +44 -0
  55. atlas_local_lib_py-0.1.0a0/tests/test_get_or_create.py +68 -0
  56. atlas_local_lib_py-0.1.0a0/tests/test_integration.py +76 -0
  57. atlas_local_lib_py-0.1.0a0/tests/test_local_deployment.py +7 -0
  58. atlas_local_lib_py-0.1.0a0/tests/test_smoke.py +36 -0
  59. atlas_local_lib_py-0.1.0a0/tests/test_start.py +21 -0
@@ -0,0 +1,67 @@
1
+ version: 2
2
+ updates:
3
+ # Enable version updates for Rust/Cargo dependencies
4
+ - package-ecosystem: "cargo"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "weekly"
8
+ day: "monday"
9
+ time: "09:00"
10
+ open-pull-requests-limit: 10
11
+ commit-message:
12
+ prefix: "chore(deps)"
13
+ labels:
14
+ - "dependencies"
15
+ # Group updates by type to separate security from version updates
16
+ groups:
17
+ rust-security:
18
+ applies-to: security-updates
19
+ patterns:
20
+ - "*"
21
+ rust-version-updates:
22
+ applies-to: version-updates
23
+ patterns:
24
+ - "*"
25
+ cooldown:
26
+ default-days: 7
27
+
28
+ # Enable version updates for Python dependencies and build/dev tooling
29
+ # (e.g. maturin, pytest), sourced from pyproject.toml
30
+ - package-ecosystem: "pip"
31
+ directory: "/"
32
+ schedule:
33
+ interval: "weekly"
34
+ day: "monday"
35
+ time: "09:00"
36
+ open-pull-requests-limit: 10
37
+ commit-message:
38
+ prefix: "chore(deps)"
39
+ labels:
40
+ - "dependencies"
41
+ # Group updates by type to separate security from version updates
42
+ groups:
43
+ python-security:
44
+ applies-to: security-updates
45
+ patterns:
46
+ - "*"
47
+ python-version-updates:
48
+ applies-to: version-updates
49
+ patterns:
50
+ - "*"
51
+ cooldown:
52
+ default-days: 7
53
+
54
+ # Enable version updates for GitHub Actions
55
+ - package-ecosystem: "github-actions"
56
+ directory: "/"
57
+ schedule:
58
+ interval: "weekly"
59
+ day: "monday"
60
+ time: "09:00"
61
+ open-pull-requests-limit: 5
62
+ commit-message:
63
+ prefix: "chore(deps)"
64
+ labels:
65
+ - "dependencies"
66
+ cooldown:
67
+ default-days: 7
@@ -0,0 +1,51 @@
1
+ <!--
2
+ The pull request title becomes the squashed commit message and feeds the
3
+ changelog, so it has to follow conventional commits:
4
+
5
+ <type>(<optional scope>): <description>
6
+
7
+ Accepted types: build, chore, ci, docs, feat, fix, perf, refactor, revert,
8
+ style, test, ops. Add `!` after the type for a breaking change.
9
+ -->
10
+
11
+ ## Summary
12
+
13
+ <!-- What changes and why. Link the Jira ticket if there is one. -->
14
+ _Jira ticket:_
15
+
16
+ ## Type of change
17
+
18
+ - [ ] Bug fix (non-breaking change which fixes an issue)
19
+ - [ ] New feature (non-breaking change which adds functionality)
20
+ - [ ] Breaking change (a change that may break existing functionality)
21
+ - [ ] Documentation fix or enhancement
22
+ - [ ] Build, CI or tooling change
23
+ - [ ] Other (please describe the change in the Summary section)
24
+
25
+
26
+ ## Public API
27
+
28
+ <!-- Delete this section if the Python surface is untouched. -->
29
+
30
+ - [ ] Public API changes are covered by appropriate tests
31
+ - [ ] Errors use the most specific existing exception, or introduce a new one when appropriate
32
+ - [ ] `README.md` and relevant examples are up to date
33
+
34
+
35
+ ## Checklist
36
+
37
+ - [ ] I have signed the [MongoDB CLA](https://www.mongodb.com/legal/contributor-agreement)
38
+ - [ ] I have read [CONTRIBUTING.md](../CONTRIBUTING.md)
39
+ - [ ] I have added tests that prove my fix is effective or that my feature works
40
+ - [ ] I have run `cargo fmt` and `ruff format .`
41
+ - [ ] `cargo clippy --all-targets -- -D warnings` and `ruff check .` pass
42
+ - [ ] `cargo test` and `pytest` pass
43
+ - [ ] `pytest -m integration` passes, or the change cannot affect it
44
+ - [ ] `LICENSE-3RD-PARTY.txt` is regenerated, or no dependency changed
45
+
46
+ ## Testing
47
+
48
+ <!--
49
+ How this was verified beyond the suites above: commands run, output, or the
50
+ scenario exercised by hand.
51
+ -->
@@ -0,0 +1,29 @@
1
+ name: "Check PR Title"
2
+ on:
3
+ pull_request:
4
+ types:
5
+ [
6
+ opened,
7
+ synchronize,
8
+ reopened,
9
+ ready_for_review,
10
+ labeled,
11
+ unlabeled,
12
+ converted_to_draft,
13
+ edited,
14
+ ]
15
+
16
+ permissions:
17
+ pull-requests: read # to read PR title and labels
18
+
19
+ jobs:
20
+ check-pr-title:
21
+ name: Check PR Title
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - name: Enforce conventional commit style
25
+ uses: realm/ci-actions/title-checker@d6cc8f067474759d38e6d24e272027b4c88bc0a9
26
+ with:
27
+ regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|ops){1}(\([\w\-\.]+\))?(!)?: .*'
28
+ error-hint: 'Invalid PR title. Make sure it follows the conventional commit specification (i.e. "<type>(<optional scope>): <description>") or add the no-title-validation label'
29
+ ignore-labels: "no-title-validation"
@@ -0,0 +1,17 @@
1
+ # synced from apix-actions/.github/workflows/close-jira.yaml
2
+ name: Auto Close Jira
3
+
4
+ on:
5
+ pull_request:
6
+ types: [closed]
7
+
8
+ permissions: {}
9
+
10
+ jobs:
11
+ close-jira:
12
+ if: contains(github.event.pull_request.labels.*.name, 'auto_close_jira')
13
+ permissions:
14
+ contents: read
15
+ pull-requests: read
16
+ uses: mongodb/apix-action/.github/workflows/_close-jira.yaml@8c5007247643059c0d15c061290a345eb987657f # main
17
+ secrets: inherit
@@ -0,0 +1,17 @@
1
+ # synced from apix-actions/.github/workflows/create-jira.yaml
2
+ name: Create Jira Ticket
3
+
4
+ on:
5
+ pull_request:
6
+ types: [labeled]
7
+
8
+ permissions: {}
9
+
10
+ jobs:
11
+ create-jira:
12
+ if: github.event.label.name == 'create_jira'
13
+ permissions:
14
+ contents: read
15
+ pull-requests: write
16
+ uses: mongodb/apix-action/.github/workflows/_create-jira.yaml@8c5007247643059c0d15c061290a345eb987657f # main
17
+ secrets: inherit
@@ -0,0 +1,36 @@
1
+ # synced from apix-actions/.github/workflows/dependabot-auto-merge.yaml
2
+ name: Auto merge dependabot prs
3
+
4
+ on:
5
+ pull_request:
6
+ types: [opened, reopened, synchronize]
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+
12
+ jobs:
13
+ auto-merge:
14
+ name: Auto merge dependabot prs
15
+ runs-on: ubuntu-latest
16
+ if: github.event.pull_request.user.login == 'dependabot[bot]'
17
+ steps:
18
+ - uses: GitHubSecurityLab/actions-permissions/monitor@bf82d13b9b10051d224345ab9184f5ede0a94289 # v1
19
+ with:
20
+ config: ${{ vars.PERMISSIONS_CONFIG }}
21
+ - name: Set APIX bot token
22
+ id: app-token
23
+ uses: mongodb/apix-action/token@8549161120ce38b1e132ff833302a0ecbde58038 # v14
24
+ with:
25
+ app-id: ${{ secrets.APIXBOT_APP_ID }}
26
+ private-key: ${{ secrets.APIXBOT_APP_PEM }}
27
+ - name: Approve PR
28
+ env:
29
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
30
+ run: |
31
+ gh pr review "${{ github.event.pull_request.html_url }}" --approve
32
+ - name: Auto merge PR
33
+ env:
34
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
35
+ run: |
36
+ gh pr merge "${{ github.event.pull_request.html_url }}" --auto --squash
@@ -0,0 +1,17 @@
1
+ # synced from apix-actions/.github/workflows/dependabot-jira.yaml
2
+ name: Create Jira Ticket for Dependabot PRs
3
+
4
+ on:
5
+ pull_request:
6
+ types: [opened]
7
+
8
+ permissions: {}
9
+
10
+ jobs:
11
+ create-jira:
12
+ if: github.actor == 'dependabot[bot]'
13
+ permissions:
14
+ contents: read
15
+ pull-requests: write
16
+ uses: mongodb/apix-action/.github/workflows/_dependabot-jira.yaml@8c5007247643059c0d15c061290a345eb987657f # main
17
+ secrets: inherit
@@ -0,0 +1,108 @@
1
+ name: Update third-party licenses
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, reopened, synchronize]
6
+
7
+ permissions:
8
+ contents: read
9
+ pull-requests: read
10
+
11
+ concurrency:
12
+ group: update-third-party-licenses-${{ github.event.pull_request.number }}
13
+ cancel-in-progress: true
14
+
15
+ jobs:
16
+ update-licenses:
17
+ name: Regenerate LICENSE-3RD-PARTY.txt
18
+ runs-on: ubuntu-latest
19
+
20
+ if: >-
21
+ github.event.pull_request.user.login == 'dependabot[bot]' &&
22
+ github.event.pull_request.head.repo.full_name == github.repository &&
23
+ (
24
+ startsWith(github.event.pull_request.head.ref, 'dependabot/cargo/') ||
25
+ startsWith(github.event.pull_request.head.ref, 'dependabot/pip/')
26
+ )
27
+
28
+ env:
29
+ CARGO_ABOUT_VERSION: "0.9.1"
30
+
31
+ steps:
32
+ - name: Create APIx bot token
33
+ id: app-token
34
+ uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
35
+ with:
36
+ app-id: ${{ secrets.APIXBOT_APP_ID }}
37
+ private-key: ${{ secrets.APIXBOT_APP_PEM }}
38
+ owner: ${{ github.repository_owner }}
39
+ repositories: ${{ github.event.repository.name }}
40
+ permission-contents: write
41
+
42
+ - name: Checkout Dependabot branch
43
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
44
+ with:
45
+ repository: ${{ github.event.pull_request.head.repo.full_name }}
46
+ ref: ${{ github.event.pull_request.head.ref }}
47
+ token: ${{ steps.app-token.outputs.token }}
48
+
49
+ - name: Install Rust toolchain
50
+ uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable
51
+ with:
52
+ toolchain: stable
53
+
54
+ - name: Set up Python
55
+ uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
56
+ with:
57
+ python-version: "3.x"
58
+
59
+ - name: Cache Cargo dependencies
60
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
61
+ with:
62
+ path: |
63
+ ~/.cargo/registry
64
+ ~/.cargo/git
65
+ target
66
+ key: ${{ runner.os }}-cargo-license-${{ hashFiles('**/Cargo.lock') }}
67
+ restore-keys: |
68
+ ${{ runner.os }}-cargo-license-
69
+
70
+ - name: Install cargo-binstall
71
+ uses: cargo-bins/cargo-binstall@e00d2c94cc0067b77737821097a62d91c0301baa # v1.21.1
72
+
73
+ - name: Install cargo-about
74
+ run: |
75
+ cargo binstall \
76
+ --no-confirm \
77
+ --locked \
78
+ --version "${CARGO_ABOUT_VERSION}" \
79
+ cargo-about
80
+
81
+ - name: Install package and Python tooling
82
+ run: |
83
+ python -m pip install --upgrade pip
84
+ pip install . pip-licenses packaging
85
+
86
+ - name: Regenerate LICENSE-3RD-PARTY.txt
87
+ run: |
88
+ set -euo pipefail
89
+ PYTHON="$(which python)" ./scripts/generate-third-party.sh
90
+
91
+ - name: Commit and push updated licenses
92
+ env:
93
+ APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
94
+ BRANCH: ${{ github.event.pull_request.head.ref }}
95
+ run: |
96
+ set -euo pipefail
97
+
98
+ if git diff --quiet -- LICENSE-3RD-PARTY.txt; then
99
+ echo "LICENSE-3RD-PARTY.txt is already up to date"
100
+ exit 0
101
+ fi
102
+
103
+ git config user.name "${APP_SLUG}[bot]"
104
+ git config user.email "${APP_SLUG}[bot]@users.noreply.github.com"
105
+
106
+ git add LICENSE-3RD-PARTY.txt
107
+ git commit -m "chore(deps): update LICENSE-3RD-PARTY.txt"
108
+ git push origin "HEAD:${BRANCH}"
@@ -0,0 +1,16 @@
1
+ # synced from apix-actions/.github/workflows/issue-closed.yaml
2
+ name: Close Jira Ticket on Issue Close
3
+
4
+ on:
5
+ issues:
6
+ types: [closed]
7
+
8
+ permissions: {}
9
+
10
+ jobs:
11
+ close-jira:
12
+ permissions:
13
+ contents: read
14
+ issues: read
15
+ uses: mongodb/apix-action/.github/workflows/_issue-closed.yaml@9ce9e6205a14af111352430e9f9adbea1c75230b # main
16
+ secrets: inherit
@@ -0,0 +1,16 @@
1
+ # synced from apix-actions/.github/workflows/issue-opened.yaml
2
+ name: Create Jira Ticket for New Issues
3
+
4
+ on:
5
+ issues:
6
+ types: [opened]
7
+
8
+ permissions: {}
9
+
10
+ jobs:
11
+ create-jira:
12
+ permissions:
13
+ contents: read
14
+ issues: write
15
+ uses: mongodb/apix-action/.github/workflows/_issue-opened.yaml@8c5007247643059c0d15c061290a345eb987657f # main
16
+ secrets: inherit
@@ -0,0 +1,16 @@
1
+ # synced from apix-actions/.github/workflows/issue-reopened.yaml
2
+ name: Reopen Jira Ticket on Issue Reopen
3
+
4
+ on:
5
+ issues:
6
+ types: [reopened]
7
+
8
+ permissions: {}
9
+
10
+ jobs:
11
+ reopen-jira:
12
+ permissions:
13
+ contents: read
14
+ issues: read
15
+ uses: mongodb/apix-action/.github/workflows/_issue-reopened.yaml@8c5007247643059c0d15c061290a345eb987657f # main
16
+ secrets: inherit
@@ -0,0 +1,76 @@
1
+ name: License compliance
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+ pull_request:
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ env:
15
+ CARGO_TERM_COLOR: always
16
+ # Tool versions (adapt as needed; not required to match atlas-local-lib).
17
+ CARGO_DENY_VERSION: "0.16.3"
18
+ CARGO_ABOUT_VERSION: "0.9.1"
19
+
20
+ jobs:
21
+ check:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
25
+
26
+ - name: Install Rust toolchain
27
+ uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable
28
+ with:
29
+ toolchain: stable
30
+
31
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
32
+ with:
33
+ python-version: "3.x"
34
+
35
+ - name: Cache cargo registry
36
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
37
+ with:
38
+ path: |
39
+ ~/.cargo/registry
40
+ ~/.cargo/git
41
+ target
42
+ key: ${{ runner.os }}-cargo-license-${{ hashFiles('**/Cargo.lock') }}
43
+ restore-keys: |
44
+ ${{ runner.os }}-cargo-license-
45
+
46
+ - name: Install cargo-binstall
47
+ uses: cargo-bins/cargo-binstall@e00d2c94cc0067b77737821097a62d91c0301baa # v1.21.1
48
+
49
+ - name: Install cargo-deny and cargo-about
50
+ run: |
51
+ cargo binstall --no-confirm --locked --version "${CARGO_DENY_VERSION}" cargo-deny
52
+ cargo binstall --no-confirm --locked --version "${CARGO_ABOUT_VERSION}" cargo-about
53
+
54
+ - name: Install package and Python tooling
55
+ run: |
56
+ python -m pip install --upgrade pip
57
+ pip install . pip-licenses packaging
58
+
59
+ # 1. Rust dependency license policy.
60
+ - name: Check Rust dependency licenses
61
+ run: cargo deny --all-features check licenses
62
+
63
+ # 2. Python dependency license policy.
64
+ - name: Check Python dependency licenses
65
+ run: PYTHON="$(which python)" ./scripts/check-python-licenses.sh
66
+
67
+ # 3. Regenerate LICENSE-3RD-PARTY.txt and fail if the checked-in copy is stale.
68
+ - name: Regenerate LICENSE-3RD-PARTY.txt
69
+ run: PYTHON="$(which python)" ./scripts/generate-third-party.sh
70
+
71
+ - name: Fail if checked-in LICENSE-3RD-PARTY.txt is stale
72
+ run: |
73
+ if ! git diff --exit-code -- LICENSE-3RD-PARTY.txt; then
74
+ echo "::error::LICENSE-3RD-PARTY.txt is out of date. Run ./scripts/generate-third-party.sh and commit the result."
75
+ exit 1
76
+ fi
@@ -0,0 +1,102 @@
1
+ name: Prepare Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: "Exact version (for example 0.1.0) or major, minor, patch"
8
+ required: true
9
+ default: patch
10
+ type: string
11
+
12
+ run-name: "Prepare release: ${{ inputs.version }}"
13
+
14
+ permissions:
15
+ contents: write
16
+
17
+ jobs:
18
+ prepare:
19
+ name: Update version and changelog
20
+ runs-on: ubuntu-latest
21
+ environment: release
22
+ steps:
23
+ - name: Validate version input
24
+ env:
25
+ INPUT_VERSION: ${{ inputs.version }}
26
+ run: |
27
+ if [[ ! "$INPUT_VERSION" =~ ^(major|minor|patch)$ ]] && [[ ! "$INPUT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
28
+ echo "::error::Invalid version input '$INPUT_VERSION'. Must be 'major', 'minor', 'patch', or a semver version (e.g. 1.2.3)."
29
+ exit 1
30
+ fi
31
+
32
+ - name: Set Apix Bot token
33
+ id: app-token
34
+ uses: mongodb/apix-action/token@8549161120ce38b1e132ff833302a0ecbde58038 # v14
35
+ with:
36
+ app-id: ${{ secrets.APIXBOT_APP_ID }}
37
+ private-key: ${{ secrets.APIXBOT_APP_PEM }}
38
+
39
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
40
+ with:
41
+ token: ${{ steps.app-token.outputs.token }}
42
+ fetch-depth: 0
43
+
44
+ - name: Install Rust toolchain
45
+ uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable
46
+ with:
47
+ toolchain: stable
48
+
49
+ - name: Install cargo-binstall
50
+ uses: cargo-bins/cargo-binstall@e00d2c94cc0067b77737821097a62d91c0301baa # v1.21.1
51
+
52
+ - name: Install cargo-edit
53
+ run: cargo binstall --no-confirm --locked cargo-edit
54
+
55
+ - name: Update Cargo.toml version
56
+ id: cargo-version
57
+ env:
58
+ INPUT_VERSION: ${{ inputs.version }}
59
+ shell: bash
60
+ run: |
61
+ case "$INPUT_VERSION" in
62
+ major|minor|patch)
63
+ cargo set-version --bump "$INPUT_VERSION"
64
+ ;;
65
+ *)
66
+ cargo set-version "$INPUT_VERSION"
67
+ ;;
68
+ esac
69
+ VERSION="$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version')"
70
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
71
+
72
+ - name: Fail if the tag already exists
73
+ env:
74
+ VERSION: ${{ steps.cargo-version.outputs.version }}
75
+ run: |
76
+ if git rev-parse -q --verify "refs/tags/v${VERSION}" >/dev/null; then
77
+ echo "::error::Tag v${VERSION} already exists."
78
+ exit 1
79
+ fi
80
+
81
+ - name: Generate changelog
82
+ uses: orhun/git-cliff-action@f50e11560dce63f7c33227798f90b924471a88b5 # v4.8.0
83
+ with:
84
+ config: cliff.toml
85
+ args: --tag ${{ steps.cargo-version.outputs.version }} --verbose
86
+ env:
87
+ OUTPUT: CHANGELOG.md
88
+ GITHUB_REPO: ${{ github.repository }}
89
+
90
+ - name: Commit version changes and create tag
91
+ env:
92
+ GIT_USER_NAME: ${{ steps.app-token.outputs.user-name }}
93
+ GIT_USER_EMAIL: ${{ steps.app-token.outputs.user-email }}
94
+ VERSION: ${{ steps.cargo-version.outputs.version }}
95
+ run: |
96
+ git config user.name "$GIT_USER_NAME"
97
+ git config user.email "$GIT_USER_EMAIL"
98
+ git add Cargo.toml Cargo.lock CHANGELOG.md
99
+ git commit -m "chore(release): prepare for ${VERSION}"
100
+ git tag "v${VERSION}"
101
+ git push origin HEAD:main
102
+ git push origin "v${VERSION}"