@@ -3,6 +3,25 @@ name: Release to PyPI
3
3
on :
4
4
release :
5
5
types : [published]
6
+ workflow_dispatch :
7
+ inputs :
8
+ version :
9
+ description : ' Version to release (e.g., 0.3.0)'
10
+ required : true
11
+ type : string
12
+ environment :
13
+ description : ' Target environment'
14
+ required : true
15
+ default : ' pypi'
16
+ type : choice
17
+ options :
18
+ - pypi
19
+ - testpypi
20
+ dry_run :
21
+ description : ' Dry run (build only, do not publish)'
22
+ required : false
23
+ default : false
24
+ type : boolean
6
25
7
26
permissions :
8
27
contents : read
@@ -116,9 +135,9 @@ jobs:
116
135
build-and-publish :
117
136
runs-on : ubuntu-latest
118
137
needs : [validate-release, security-scan, test]
119
- environment :
120
- name : pypi
121
- url : https://pypi.org/p/redis-mcp-server
138
+ environment :
139
+ name : ${{ github.event.inputs.environment || ' pypi' }}
140
+ url : ${{ github.event.inputs.environment == 'testpypi' && ' https://test. pypi.org/p/redis-mcp-server' || 'https://pypi.org/p/redis-mcp-server' }}
122
141
permissions :
123
142
id-token : write # IMPORTANT: mandatory for trusted publishing
124
143
contents : read
@@ -158,11 +177,22 @@ jobs:
158
177
subject-path : ' dist/*'
159
178
160
179
- name : ⚙️ Publish to PyPI
180
+ if : ${{ !inputs.dry_run }}
161
181
uses : pypa/gh-action-pypi-publish@release/v1
162
182
with :
183
+ repository-url : ${{ github.event.inputs.environment == 'testpypi' && 'https://test.pypi.org/legacy/' || '' }}
163
184
print-hash : true
164
185
attestations : true
165
186
187
+ - name : ⚙️ Dry run - Package ready for publishing
188
+ if : ${{ inputs.dry_run }}
189
+ run : |
190
+ echo "🔍 DRY RUN MODE - Package built successfully but not published"
191
+ echo "📦 Built packages:"
192
+ ls -la dist/
193
+ echo ""
194
+ echo "✅ Package is ready for publishing to ${{ github.event.inputs.environment || 'pypi' }}"
195
+
166
196
- name : ⚙️ Upload build artifacts
167
197
uses : actions/upload-artifact@v4
168
198
with :
@@ -177,6 +207,20 @@ jobs:
177
207
steps :
178
208
- name : ⚙️ Success notification
179
209
run : |
180
- echo "🎉 Successfully released Redis MCP Server v${{ needs.validate-release.outputs.version }} to PyPI!"
181
- echo "📦 Package: https://pypi.org/project/redis-mcp-server/${{ needs.validate-release.outputs.version }}/"
182
- echo "🏷️ Release: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"
210
+ if [[ "${{ inputs.dry_run }}" == "true" ]]; then
211
+ echo "🔍 DRY RUN COMPLETED - Redis MCP Server v${{ github.event.inputs.version || needs.validate-release.outputs.version }} ready for release!"
212
+ echo "📦 Package built successfully but not published"
213
+ echo "🎯 Target environment: ${{ github.event.inputs.environment || 'pypi' }}"
214
+ else
215
+ echo "🎉 Successfully released Redis MCP Server v${{ github.event.inputs.version || needs.validate-release.outputs.version }} to ${{ github.event.inputs.environment || 'PyPI' }}!"
216
+ if [[ "${{ github.event.inputs.environment }}" == "testpypi" ]]; then
217
+ echo "📦 Package: https://test.pypi.org/project/redis-mcp-server/${{ github.event.inputs.version || needs.validate-release.outputs.version }}/"
218
+ else
219
+ echo "📦 Package: https://pypi.org/project/redis-mcp-server/${{ github.event.inputs.version || needs.validate-release.outputs.version }}/"
220
+ fi
221
+ if [[ "${{ github.event_name }}" == "release" ]]; then
222
+ echo "🏷️ Release: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"
223
+ else
224
+ echo "🚀 Manual release triggered by: ${{ github.actor }}"
225
+ fi
226
+ fi
0 commit comments