-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsecurity_patch.patch
More file actions
168 lines (168 loc) · 10.7 KB
/
security_patch.patch
File metadata and controls
168 lines (168 loc) · 10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
new file mode 100644
index 0000000..0ece9f7
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,49 @@
+name: Publish to PyPI
+
+on:
+ release:
+ types: [published]
+ workflow_dispatch:
+ inputs:
+ test:
+ description: 'Upload to TestPyPI instead of PyPI'
+ required: false
+ default: 'false'
+ type: boolean
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.9'
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install build twine
+
+ - name: Build package
+ run: python -m build
+
+ - name: Check package
+ run: python -m twine check dist/*
+
+ - name: Upload to TestPyPI
+ if: github.event.inputs.test == 'true'
+ env:
+ TWINE_USERNAME: __token__
+ TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
+ run: python -m twine upload --repository testpypi dist/*
+
+ - name: Upload to PyPI
+ if: github.event.inputs.test != 'true'
+ env:
+ TWINE_USERNAME: __token__
+ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
+ run: python -m twine upload dist/*
\ No newline at end of file
diff --git a/.pypirc.example b/.pypirc.example
new file mode 100644
index 0000000..4190695
--- /dev/null
+++ b/.pypirc.example
@@ -0,0 +1,20 @@
+# PyPI Configuration Example
+# Copy this to ~/.pypirc and add your API tokens
+#
+# Get tokens from:
+# - PyPI: https://pypi.org/manage/account/token/
+# - TestPyPI: https://test.pypi.org/manage/account/token/
+
+[distutils]
+index-servers =
+ pypi
+ testpypi
+
+[pypi]
+username = __token__
+password = pypi-YOUR_REAL_TOKEN_HERE
+
+[testpypi]
+repository = https://test.pypi.org/legacy/
+username = __token__
+password = pypi-YOUR_TEST_TOKEN_HERE
\ No newline at end of file
diff --git a/scripts/build_pypi.ps1 b/scripts/build_pypi.ps1
new file mode 100644
index 0000000..8edd3e3
--- /dev/null
+++ b/scripts/build_pypi.ps1
@@ -0,0 +1,79 @@
+# Build and publish Story Test Framework to PyPI
+# Usage:
+# .\scripts\build_pypi.ps1 # Build only
+# .\scripts\build_pypi.ps1 -Test # Upload to TestPyPI
+# .\scripts\build_pypi.ps1 -Publish # Upload to PyPI
+
+param(
+ [switch]$Test,
+ [switch]$Publish,
+ [switch]$Clean
+)
+
+$ErrorActionPreference = "Stop"
+
+Write-Host "🎯 Story Test Framework - PyPI Build Script" -ForegroundColor Cyan
+Write-Host "=" * 60
+
+# Clean previous builds
+if ($Clean -or $Test -or $Publish) {
+ Write-Host "`n🧹 Cleaning previous builds..." -ForegroundColor Yellow
+ if (Test-Path "dist") { Remove-Item -Recurse -Force "dist" }
+ if (Test-Path "build") { Remove-Item -Recurse -Force "build" }
+ if (Test-Path "storytest.egg-info") { Remove-Item -Recurse -Force "storytest.egg-info" }
+ Write-Host "✓ Cleaned" -ForegroundColor Green
+}
+
+# Install/upgrade build tools
+Write-Host "`n📦 Installing build tools..." -ForegroundColor Yellow
+python -m pip install --upgrade pip
+python -m pip install --upgrade build twine
+Write-Host "✓ Build tools ready" -ForegroundColor Green
+
+# Build the package
+Write-Host "`n🔨 Building package..." -ForegroundColor Yellow
+python -m build
+Write-Host "✓ Package built successfully" -ForegroundColor Green
+
+# List built files
+Write-Host "`n📋 Built files:" -ForegroundColor Cyan
+Get-ChildItem dist | ForEach-Object { Write-Host " • $($_.Name)" }
+
+# Check package
+Write-Host "`n🔍 Checking package..." -ForegroundColor Yellow
+python -m twine check dist/*
+Write-Host "✓ Package check passed" -ForegroundColor Green
+
+if ($Test) {
+ Write-Host "`n🧪 Uploading to TestPyPI..." -ForegroundColor Yellow
+ Write-Host "You will need your TestPyPI API token" -ForegroundColor Gray
+ python -m twine upload --repository testpypi dist/*
+ Write-Host "`n✓ Uploaded to TestPyPI" -ForegroundColor Green
+ Write-Host "`nTest installation with:" -ForegroundColor Cyan
+ Write-Host " pip install --index-url https://test.pypi.org/simple/ storytest" -ForegroundColor White
+}
+elseif ($Publish) {
+ Write-Host "`n🚀 Uploading to PyPI..." -ForegroundColor Yellow
+ Write-Host "⚠️ This will publish to the REAL PyPI!" -ForegroundColor Red
+ $confirm = Read-Host "Are you sure? (yes/no)"
+
+ if ($confirm -eq "yes") {
+ Write-Host "You will need your PyPI API token" -ForegroundColor Gray
+ python -m twine upload dist/*
+ Write-Host "`n✅ Published to PyPI!" -ForegroundColor Green
+ Write-Host "`nInstall with:" -ForegroundColor Cyan
+ Write-Host " pip install storytest" -ForegroundColor White
+ }
+ else {
+ Write-Host "`n❌ Publish cancelled" -ForegroundColor Red
+ }
+}
+else {
+ Write-Host "`n✅ Build complete!" -ForegroundColor Green
+ Write-Host "`nNext steps:" -ForegroundColor Cyan
+ Write-Host " • Test locally: pip install -e ." -ForegroundColor White
+ Write-Host " • Upload to TestPyPI: .\scripts\build_pypi.ps1 -Test" -ForegroundColor White
+ Write-Host " • Publish to PyPI: .\scripts\build_pypi.ps1 -Publish" -ForegroundColor White
+}
+
+Write-Host "`n" + ("=" * 60)
\ No newline at end of file