fastapi-csp-docs 0.1.0__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.
- fastapi_csp_docs-0.1.0/.github/dependabot.yml +50 -0
- fastapi_csp_docs-0.1.0/.github/labeler.yml +22 -0
- fastapi_csp_docs-0.1.0/.github/workflows/create-draft-release.yml +56 -0
- fastapi_csp_docs-0.1.0/.github/workflows/detect-conflicts.yml +22 -0
- fastapi_csp_docs-0.1.0/.github/workflows/guard-dependencies.yml +53 -0
- fastapi_csp_docs-0.1.0/.github/workflows/labeler.yml +37 -0
- fastapi_csp_docs-0.1.0/.github/workflows/latest-changes.yml +50 -0
- fastapi_csp_docs-0.1.0/.github/workflows/pre-commit.yml +63 -0
- fastapi_csp_docs-0.1.0/.github/workflows/prepare-release.yml +85 -0
- fastapi_csp_docs-0.1.0/.github/workflows/publish.yml +40 -0
- fastapi_csp_docs-0.1.0/.github/workflows/test-redistribute.yml +88 -0
- fastapi_csp_docs-0.1.0/.github/workflows/test.yml +172 -0
- fastapi_csp_docs-0.1.0/.github/workflows/zizmor.yml +25 -0
- fastapi_csp_docs-0.1.0/.gitignore +35 -0
- fastapi_csp_docs-0.1.0/.pre-commit-config.yaml +59 -0
- fastapi_csp_docs-0.1.0/.python-version +1 -0
- fastapi_csp_docs-0.1.0/LICENSE +21 -0
- fastapi_csp_docs-0.1.0/PKG-INFO +220 -0
- fastapi_csp_docs-0.1.0/README.md +189 -0
- fastapi_csp_docs-0.1.0/RELEASE_NOTES.md +32 -0
- fastapi_csp_docs-0.1.0/examples/__init__.py +0 -0
- fastapi_csp_docs-0.1.0/examples/_csp.py +83 -0
- fastapi_csp_docs-0.1.0/examples/assisted_app.py +39 -0
- fastapi_csp_docs-0.1.0/examples/mounted_subapp_app.py +39 -0
- fastapi_csp_docs-0.1.0/examples/oauth2_redirect_app.py +48 -0
- fastapi_csp_docs-0.1.0/examples/redoc_disable_search_app.py +90 -0
- fastapi_csp_docs-0.1.0/examples/root_path_app.py +43 -0
- fastapi_csp_docs-0.1.0/examples/self_hosted_app.py +153 -0
- fastapi_csp_docs-0.1.0/examples/static/favicon.png +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-cyrillic-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-cyrillic-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-cyrillic-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-cyrillic-ext-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-cyrillic-ext-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-cyrillic-ext-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-latin-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-latin-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-latin-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-latin-ext-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-latin-ext-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-latin-ext-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-vietnamese-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-vietnamese-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/montserrat-vietnamese-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-cyrillic-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-cyrillic-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-cyrillic-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-cyrillic-ext-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-cyrillic-ext-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-cyrillic-ext-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-greek-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-greek-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-greek-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-greek-ext-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-greek-ext-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-greek-ext-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-latin-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-latin-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-latin-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-latin-ext-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-latin-ext-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-latin-ext-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-math-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-math-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-math-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-symbols-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-symbols-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-symbols-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-vietnamese-300-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-vietnamese-400-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts/roboto-vietnamese-700-normal.woff2 +0 -0
- fastapi_csp_docs-0.1.0/examples/static/fonts.css +452 -0
- fastapi_csp_docs-0.1.0/examples/static/redoc.standalone.js +1838 -0
- fastapi_csp_docs-0.1.0/examples/static/swagger-ui-bundle.js +2 -0
- fastapi_csp_docs-0.1.0/examples/static/swagger-ui.css +3 -0
- fastapi_csp_docs-0.1.0/fastapi_csp_docs/__init__.py +21 -0
- fastapi_csp_docs-0.1.0/fastapi_csp_docs/docs.py +252 -0
- fastapi_csp_docs-0.1.0/fastapi_csp_docs/py.typed +0 -0
- fastapi_csp_docs-0.1.0/fastapi_csp_docs/setup.py +145 -0
- fastapi_csp_docs-0.1.0/pyproject.toml +143 -0
- fastapi_csp_docs-0.1.0/scripts/format.sh +5 -0
- fastapi_csp_docs-0.1.0/scripts/lint.sh +9 -0
- fastapi_csp_docs-0.1.0/scripts/prepare_release.py +189 -0
- fastapi_csp_docs-0.1.0/scripts/test-cov-html.sh +8 -0
- fastapi_csp_docs-0.1.0/scripts/test-cov.sh +6 -0
- fastapi_csp_docs-0.1.0/scripts/test.sh +6 -0
- fastapi_csp_docs-0.1.0/tests/__init__.py +0 -0
- fastapi_csp_docs-0.1.0/tests/test_docs.py +159 -0
- fastapi_csp_docs-0.1.0/tests/test_prepare_release.py +211 -0
- fastapi_csp_docs-0.1.0/tests/test_setup.py +149 -0
- fastapi_csp_docs-0.1.0/uv.lock +1037 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
# GitHub Actions
|
|
4
|
+
- package-ecosystem: "github-actions"
|
|
5
|
+
directory: "/"
|
|
6
|
+
schedule:
|
|
7
|
+
interval: "weekly"
|
|
8
|
+
cooldown:
|
|
9
|
+
default-days: 7
|
|
10
|
+
commit-message:
|
|
11
|
+
prefix: ⬆
|
|
12
|
+
labels:
|
|
13
|
+
- "internal"
|
|
14
|
+
- "dependencies"
|
|
15
|
+
- "github_actions"
|
|
16
|
+
groups:
|
|
17
|
+
github-actions:
|
|
18
|
+
patterns:
|
|
19
|
+
- "*"
|
|
20
|
+
# Python
|
|
21
|
+
- package-ecosystem: "uv"
|
|
22
|
+
directory: "/"
|
|
23
|
+
schedule:
|
|
24
|
+
interval: "weekly"
|
|
25
|
+
cooldown:
|
|
26
|
+
default-days: 7
|
|
27
|
+
commit-message:
|
|
28
|
+
prefix: ⬆
|
|
29
|
+
groups:
|
|
30
|
+
python-packages:
|
|
31
|
+
dependency-type: "development"
|
|
32
|
+
patterns:
|
|
33
|
+
- "*"
|
|
34
|
+
# pre-commit
|
|
35
|
+
- package-ecosystem: "pre-commit"
|
|
36
|
+
directory: "/"
|
|
37
|
+
schedule:
|
|
38
|
+
interval: "weekly"
|
|
39
|
+
cooldown:
|
|
40
|
+
default-days: 7
|
|
41
|
+
commit-message:
|
|
42
|
+
prefix: ⬆
|
|
43
|
+
labels:
|
|
44
|
+
- "internal"
|
|
45
|
+
- "dependencies"
|
|
46
|
+
- "pre-commit"
|
|
47
|
+
groups:
|
|
48
|
+
pre-commit:
|
|
49
|
+
patterns:
|
|
50
|
+
- "*"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
docs:
|
|
2
|
+
- all:
|
|
3
|
+
- changed-files:
|
|
4
|
+
- any-glob-to-any-file:
|
|
5
|
+
- README.md
|
|
6
|
+
- RELEASE_NOTES.md
|
|
7
|
+
- all-globs-to-all-files:
|
|
8
|
+
- '!fastapi_csp_docs/**'
|
|
9
|
+
- '!pyproject.toml'
|
|
10
|
+
|
|
11
|
+
internal:
|
|
12
|
+
- all:
|
|
13
|
+
- changed-files:
|
|
14
|
+
- any-glob-to-any-file:
|
|
15
|
+
- .github/**
|
|
16
|
+
- scripts/**
|
|
17
|
+
- .gitignore
|
|
18
|
+
- .pre-commit-config.yaml
|
|
19
|
+
- uv.lock
|
|
20
|
+
- all-globs-to-all-files:
|
|
21
|
+
- '!fastapi_csp_docs/**'
|
|
22
|
+
- '!pyproject.toml'
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: Create Draft Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types:
|
|
6
|
+
- closed
|
|
7
|
+
|
|
8
|
+
permissions: {}
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
create-draft-release:
|
|
12
|
+
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
timeout-minutes: 5
|
|
15
|
+
permissions:
|
|
16
|
+
contents: write
|
|
17
|
+
env:
|
|
18
|
+
PREPARE_RELEASE_VERSION_FILE: fastapi_csp_docs/__init__.py
|
|
19
|
+
PREPARE_RELEASE_RELEASE_NOTES_FILE: RELEASE_NOTES.md
|
|
20
|
+
steps:
|
|
21
|
+
- name: Dump GitHub context
|
|
22
|
+
env:
|
|
23
|
+
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
24
|
+
run: echo "$GITHUB_CONTEXT"
|
|
25
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
26
|
+
with:
|
|
27
|
+
ref: ${{ github.event.repository.default_branch }}
|
|
28
|
+
persist-credentials: true
|
|
29
|
+
- name: Set up Python
|
|
30
|
+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
|
31
|
+
with:
|
|
32
|
+
python-version-file: ".python-version"
|
|
33
|
+
- name: Install uv
|
|
34
|
+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
35
|
+
with:
|
|
36
|
+
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
37
|
+
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
38
|
+
version: "0.11.18"
|
|
39
|
+
- name: Extract release details
|
|
40
|
+
id: release-details
|
|
41
|
+
run: |
|
|
42
|
+
set -euo pipefail
|
|
43
|
+
version="$(uv run python scripts/prepare_release.py current-version)"
|
|
44
|
+
uv run python scripts/prepare_release.py release-notes > draft-release-notes.md
|
|
45
|
+
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
46
|
+
- name: Create draft release
|
|
47
|
+
env:
|
|
48
|
+
GH_TOKEN: ${{ github.token }}
|
|
49
|
+
VERSION: ${{ steps.release-details.outputs.version }}
|
|
50
|
+
run: |
|
|
51
|
+
set -euo pipefail
|
|
52
|
+
gh release create "$VERSION" \
|
|
53
|
+
--draft \
|
|
54
|
+
--title "$VERSION" \
|
|
55
|
+
--notes-file draft-release-notes.md \
|
|
56
|
+
--target "$(git rev-parse HEAD)"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: "Conflict detector"
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
pull_request_target: # zizmor: ignore[dangerous-triggers]
|
|
5
|
+
types: [synchronize]
|
|
6
|
+
|
|
7
|
+
permissions: {}
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
main:
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
pull-requests: write
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
timeout-minutes: 5
|
|
16
|
+
steps:
|
|
17
|
+
- name: Check if PRs have merge conflicts
|
|
18
|
+
uses: eps1lon/actions-label-merge-conflict@0273be72a0bbd58fcd71d0d6c02c209b50d1e5e1 # v3.1.0
|
|
19
|
+
with:
|
|
20
|
+
dirtyLabel: "conflicts"
|
|
21
|
+
repoToken: "${{ secrets.GITHUB_TOKEN }}"
|
|
22
|
+
commentOnDirty: "This pull request has a merge conflict that needs to be resolved."
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: Guard Dependencies
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request_target: # zizmor: ignore[dangerous-triggers] -- This workflow only reads context.payload metadata, never checks out PR code
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- pyproject.toml
|
|
8
|
+
- uv.lock
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
issues: write
|
|
13
|
+
pull-requests: write
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
check-author:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
timeout-minutes: 5
|
|
19
|
+
steps:
|
|
20
|
+
- name: Check if author is org member or allowed bot
|
|
21
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
22
|
+
with:
|
|
23
|
+
script: |
|
|
24
|
+
const pr = context.payload.pull_request;
|
|
25
|
+
const author = pr.user.login;
|
|
26
|
+
const assoc = pr.author_association;
|
|
27
|
+
|
|
28
|
+
const botAllowlist = new Set(['dependabot[bot]']);
|
|
29
|
+
const orgAuthorAssociations = new Set(['MEMBER', 'OWNER']);
|
|
30
|
+
|
|
31
|
+
const allowed =
|
|
32
|
+
botAllowlist.has(author) ||
|
|
33
|
+
(assoc != null && orgAuthorAssociations.has(assoc));
|
|
34
|
+
|
|
35
|
+
if (!allowed) {
|
|
36
|
+
await github.rest.issues.createComment({
|
|
37
|
+
owner: context.repo.owner,
|
|
38
|
+
repo: context.repo.repo,
|
|
39
|
+
issue_number: context.payload.pull_request.number,
|
|
40
|
+
body: `This PR modifies dependency files (\`pyproject.toml\` or \`uv.lock\`), which is restricted to members of the **${context.repo.owner}** organization on GitHub.\n\nIf you need a dependency change, please [open a discussion](https://github.com/${context.repo.owner}/${context.repo.repo}/discussions/new) describing what you need and why.\n\nClosing this PR automatically.`
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
await github.rest.pulls.update({
|
|
44
|
+
owner: context.repo.owner,
|
|
45
|
+
repo: context.repo.repo,
|
|
46
|
+
pull_number: context.payload.pull_request.number,
|
|
47
|
+
state: 'closed'
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
core.setFailed('Dependency changes are restricted to organization members.');
|
|
51
|
+
} else {
|
|
52
|
+
console.log(`Author ${author} (author_association=${assoc}) is allowed to make dependency changes.`);
|
|
53
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Labels
|
|
2
|
+
on:
|
|
3
|
+
pull_request_target: # zizmor: ignore[dangerous-triggers]
|
|
4
|
+
types:
|
|
5
|
+
- opened
|
|
6
|
+
- synchronize
|
|
7
|
+
- reopened
|
|
8
|
+
# For label-checker
|
|
9
|
+
- labeled
|
|
10
|
+
- unlabeled
|
|
11
|
+
|
|
12
|
+
permissions: {}
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
labeler:
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
pull-requests: write
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
timeout-minutes: 5
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/labeler@f27b608878404679385c85cfa523b85ccb86e213 # v6.1.0
|
|
23
|
+
if: ${{ github.event.action != 'labeled' && github.event.action != 'unlabeled' }}
|
|
24
|
+
- run: echo "Done adding labels"
|
|
25
|
+
# Run this after labeler applied labels
|
|
26
|
+
check-labels:
|
|
27
|
+
needs:
|
|
28
|
+
- labeler
|
|
29
|
+
permissions:
|
|
30
|
+
pull-requests: read
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
timeout-minutes: 5
|
|
33
|
+
steps:
|
|
34
|
+
- uses: agilepathway/label-checker@c3d16ad512e7cea5961df85ff2486bb774caf3c5 # v1.6.65
|
|
35
|
+
with:
|
|
36
|
+
one_of: breaking,security,feature,bug,refactor,upgrade,docs,internal,release
|
|
37
|
+
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Latest Changes
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request_target: # zizmor: ignore[dangerous-triggers]
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
types:
|
|
8
|
+
- closed
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
inputs:
|
|
11
|
+
number:
|
|
12
|
+
description: PR number
|
|
13
|
+
required: true
|
|
14
|
+
debug_enabled:
|
|
15
|
+
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
|
|
16
|
+
required: false
|
|
17
|
+
default: 'false'
|
|
18
|
+
|
|
19
|
+
permissions: {}
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
latest-changes:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true
|
|
25
|
+
timeout-minutes: 5
|
|
26
|
+
steps:
|
|
27
|
+
- name: Dump GitHub context
|
|
28
|
+
env:
|
|
29
|
+
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
30
|
+
run: echo "$GITHUB_CONTEXT"
|
|
31
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
32
|
+
with:
|
|
33
|
+
ref: ${{ github.event.repository.default_branch }}
|
|
34
|
+
# To allow latest-changes to commit to the main branch
|
|
35
|
+
token: ${{ secrets.FASTAPI_CSP_DOCS_LATEST_CHANGES }} # zizmor: ignore[secrets-outside-env]
|
|
36
|
+
persist-credentials: true # required by tiangolo/latest-changes
|
|
37
|
+
# Allow debugging with tmate
|
|
38
|
+
- name: Setup tmate session
|
|
39
|
+
uses: mxschmitt/action-tmate@35b54afac29c97fb54faba5b513f8fbd1882f113 # v3.24
|
|
40
|
+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
|
|
41
|
+
with:
|
|
42
|
+
limit-access-to-actor: true
|
|
43
|
+
- uses: tiangolo/latest-changes@c9b73efbc8992ef1a401e4235ea307a8ca8a724b # 0.6.1
|
|
44
|
+
with:
|
|
45
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
46
|
+
latest_changes_file: RELEASE_NOTES.md
|
|
47
|
+
latest_changes_header: '## Latest Changes'
|
|
48
|
+
end_regex: '^## '
|
|
49
|
+
debug_logs: true
|
|
50
|
+
label_header_prefix: '### '
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: pre-commit
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
|
|
6
|
+
permissions: {}
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
pre-commit:
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
timeout-minutes: 5
|
|
14
|
+
steps:
|
|
15
|
+
- name: Dump GitHub context
|
|
16
|
+
env:
|
|
17
|
+
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
18
|
+
run: echo "$GITHUB_CONTEXT"
|
|
19
|
+
|
|
20
|
+
- name: Checkout code
|
|
21
|
+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
22
|
+
with:
|
|
23
|
+
persist-credentials: false
|
|
24
|
+
# Full history required for --from-ref/--to-ref diff in prek
|
|
25
|
+
fetch-depth: 0
|
|
26
|
+
|
|
27
|
+
- name: Set up Python
|
|
28
|
+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
|
29
|
+
with:
|
|
30
|
+
python-version-file: ".python-version"
|
|
31
|
+
|
|
32
|
+
- name: Setup uv
|
|
33
|
+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
34
|
+
with:
|
|
35
|
+
version: "0.11.18"
|
|
36
|
+
cache-dependency-glob: |
|
|
37
|
+
pyproject.toml
|
|
38
|
+
uv.lock
|
|
39
|
+
|
|
40
|
+
- name: Install Dependencies
|
|
41
|
+
run: uv sync --locked
|
|
42
|
+
|
|
43
|
+
- name: Run prek - pre-commit
|
|
44
|
+
# Only lint files changed in this PR, not the entire repo
|
|
45
|
+
run: uv run prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure
|
|
46
|
+
|
|
47
|
+
# https://github.com/marketplace/actions/alls-green#why
|
|
48
|
+
pre-commit-alls-green: # This job does nothing and is only used for the branch protection
|
|
49
|
+
if: always()
|
|
50
|
+
needs:
|
|
51
|
+
- pre-commit
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
timeout-minutes: 5
|
|
54
|
+
steps:
|
|
55
|
+
- name: Dump GitHub context
|
|
56
|
+
env:
|
|
57
|
+
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
58
|
+
run: echo "$GITHUB_CONTEXT"
|
|
59
|
+
|
|
60
|
+
- name: Decide whether the needed jobs succeeded or failed
|
|
61
|
+
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
|
|
62
|
+
with:
|
|
63
|
+
jobs: ${{ toJSON(needs) }}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
name: Prepare Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
bump:
|
|
7
|
+
description: Release bump
|
|
8
|
+
required: true
|
|
9
|
+
type: choice
|
|
10
|
+
options:
|
|
11
|
+
- patch
|
|
12
|
+
- minor
|
|
13
|
+
- major
|
|
14
|
+
date:
|
|
15
|
+
description: Release date in YYYY-MM-DD format. Defaults to today.
|
|
16
|
+
required: false
|
|
17
|
+
type: string
|
|
18
|
+
|
|
19
|
+
permissions: {}
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
prepare-release:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
timeout-minutes: 5
|
|
25
|
+
permissions:
|
|
26
|
+
contents: write
|
|
27
|
+
issues: write
|
|
28
|
+
pull-requests: write
|
|
29
|
+
env:
|
|
30
|
+
PREPARE_RELEASE_VERSION_FILE: fastapi_csp_docs/__init__.py
|
|
31
|
+
PREPARE_RELEASE_RELEASE_NOTES_FILE: RELEASE_NOTES.md
|
|
32
|
+
steps:
|
|
33
|
+
- name: Dump GitHub context
|
|
34
|
+
env:
|
|
35
|
+
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
36
|
+
run: echo "$GITHUB_CONTEXT"
|
|
37
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
38
|
+
with:
|
|
39
|
+
token: ${{ secrets.FASTAPI_CSP_DOCS_LATEST_CHANGES }} # zizmor: ignore[secrets-outside-env]
|
|
40
|
+
persist-credentials: true
|
|
41
|
+
- name: Set up Python
|
|
42
|
+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
|
43
|
+
with:
|
|
44
|
+
python-version-file: ".python-version"
|
|
45
|
+
- name: Install uv
|
|
46
|
+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
47
|
+
with:
|
|
48
|
+
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
49
|
+
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
50
|
+
version: "0.11.18"
|
|
51
|
+
- name: Prepare release
|
|
52
|
+
env:
|
|
53
|
+
PREPARE_RELEASE_BUMP: ${{ inputs.bump }}
|
|
54
|
+
PREPARE_RELEASE_DATE: ${{ inputs.date }}
|
|
55
|
+
run: uv run python scripts/prepare_release.py prepare
|
|
56
|
+
- name: Get release version
|
|
57
|
+
id: release-version
|
|
58
|
+
run: |
|
|
59
|
+
version="$(uv run python scripts/prepare_release.py current-version)"
|
|
60
|
+
echo "$version"
|
|
61
|
+
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
62
|
+
- name: Ensure release label exists
|
|
63
|
+
env:
|
|
64
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
65
|
+
run: |
|
|
66
|
+
gh label create release --color 0075ca --description "Release PR" 2>/dev/null || true
|
|
67
|
+
- name: Create release pull request
|
|
68
|
+
env:
|
|
69
|
+
GH_TOKEN: ${{ secrets.FASTAPI_CSP_DOCS_LATEST_CHANGES }}
|
|
70
|
+
VERSION: ${{ steps.release-version.outputs.version }}
|
|
71
|
+
run: |
|
|
72
|
+
set -euo pipefail
|
|
73
|
+
branch="release-${VERSION}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
|
|
74
|
+
git config user.name "github-actions[bot]"
|
|
75
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
76
|
+
git switch -c "$branch"
|
|
77
|
+
git add $PREPARE_RELEASE_VERSION_FILE $PREPARE_RELEASE_RELEASE_NOTES_FILE
|
|
78
|
+
git commit -m "🔖 Release version ${VERSION}"
|
|
79
|
+
git push --set-upstream origin "$branch"
|
|
80
|
+
gh pr create \
|
|
81
|
+
--base main \
|
|
82
|
+
--head "$branch" \
|
|
83
|
+
--title "🔖 Release version ${VERSION}" \
|
|
84
|
+
--body "Prepare release ${VERSION}." \
|
|
85
|
+
--label release
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types:
|
|
6
|
+
- published
|
|
7
|
+
|
|
8
|
+
permissions: {}
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
environment: pypi
|
|
14
|
+
permissions:
|
|
15
|
+
id-token: write
|
|
16
|
+
contents: read
|
|
17
|
+
timeout-minutes: 5
|
|
18
|
+
steps:
|
|
19
|
+
- name: Dump GitHub context
|
|
20
|
+
env:
|
|
21
|
+
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
22
|
+
run: echo "$GITHUB_CONTEXT"
|
|
23
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
24
|
+
with:
|
|
25
|
+
persist-credentials: false
|
|
26
|
+
- name: Set up Python
|
|
27
|
+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
|
28
|
+
with:
|
|
29
|
+
python-version-file: ".python-version"
|
|
30
|
+
- name: Install uv
|
|
31
|
+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
32
|
+
with:
|
|
33
|
+
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
34
|
+
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
35
|
+
version: "0.11.18"
|
|
36
|
+
enable-cache: "false"
|
|
37
|
+
- name: Build distribution
|
|
38
|
+
run: uv build
|
|
39
|
+
- name: Publish
|
|
40
|
+
run: uv publish
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
name: Test Redistribute
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
permissions: {}
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
changes:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
pull-requests: read
|
|
16
|
+
timeout-minutes: 5
|
|
17
|
+
outputs:
|
|
18
|
+
src: ${{ steps.filter.outputs.src }}
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
21
|
+
with:
|
|
22
|
+
persist-credentials: false
|
|
23
|
+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
|
|
24
|
+
id: filter
|
|
25
|
+
with:
|
|
26
|
+
filters: |
|
|
27
|
+
src:
|
|
28
|
+
- .github/workflows/test-redistribute.yml
|
|
29
|
+
- fastapi_csp_docs/**
|
|
30
|
+
- tests/**
|
|
31
|
+
- .python-version
|
|
32
|
+
- pyproject.toml
|
|
33
|
+
- uv.lock
|
|
34
|
+
|
|
35
|
+
test-redistribute:
|
|
36
|
+
needs:
|
|
37
|
+
- changes
|
|
38
|
+
if: needs.changes.outputs.src == 'true' || github.ref == 'refs/heads/main'
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
timeout-minutes: 5
|
|
41
|
+
permissions:
|
|
42
|
+
contents: read
|
|
43
|
+
steps:
|
|
44
|
+
- name: Dump GitHub context
|
|
45
|
+
env:
|
|
46
|
+
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
47
|
+
run: echo "$GITHUB_CONTEXT"
|
|
48
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
49
|
+
with:
|
|
50
|
+
persist-credentials: false
|
|
51
|
+
- name: Set up Python
|
|
52
|
+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
|
53
|
+
with:
|
|
54
|
+
python-version-file: ".python-version"
|
|
55
|
+
- name: Install build dependencies
|
|
56
|
+
run: pip install build
|
|
57
|
+
- name: Build source distribution
|
|
58
|
+
run: python -m build --sdist
|
|
59
|
+
- name: Decompress source distribution
|
|
60
|
+
run: |
|
|
61
|
+
cd dist
|
|
62
|
+
tar xvf fastapi_csp_docs*.tar.gz
|
|
63
|
+
- name: Install test dependencies
|
|
64
|
+
run: |
|
|
65
|
+
cd dist/fastapi_csp_docs*/
|
|
66
|
+
pip install --group dev --editable .
|
|
67
|
+
- name: Run source distribution tests
|
|
68
|
+
run: |
|
|
69
|
+
cd dist/fastapi_csp_docs*/
|
|
70
|
+
bash scripts/test.sh
|
|
71
|
+
- name: Build wheel distribution
|
|
72
|
+
run: |
|
|
73
|
+
cd dist
|
|
74
|
+
pip wheel --no-deps fastapi_csp_docs*.tar.gz
|
|
75
|
+
|
|
76
|
+
# https://github.com/marketplace/actions/alls-green#why
|
|
77
|
+
test-redistribute-alls-green: # This job does nothing and is only used for the branch protection
|
|
78
|
+
if: always()
|
|
79
|
+
needs:
|
|
80
|
+
- test-redistribute
|
|
81
|
+
runs-on: ubuntu-latest
|
|
82
|
+
timeout-minutes: 5
|
|
83
|
+
steps:
|
|
84
|
+
- name: Decide whether the needed jobs succeeded or failed
|
|
85
|
+
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
|
|
86
|
+
with:
|
|
87
|
+
jobs: ${{ toJSON(needs) }}
|
|
88
|
+
allowed-skips: test-redistribute
|