Skip to content

Commit 02fd409

Browse files
fixes
1 parent f067876 commit 02fd409

File tree

1 file changed

+42
-23
lines changed

1 file changed

+42
-23
lines changed

.github/workflows/tidy3d-python-client-release.yml

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ on:
99
type: string
1010

1111
release_type:
12-
description: 'Release Type (draft=test, final=PyPI)'
12+
description: 'Release Type (determines deployment targets)'
1313
type: choice
1414
default: 'draft'
1515
required: false
1616
options:
1717
- draft
18-
- final
18+
- codeartifact
19+
- testpypi
20+
- pypi
1921

2022
workflow_control:
2123
description: 'Workflow Stage Control'
@@ -69,7 +71,7 @@ on:
6971
type: string
7072

7173
release_type:
72-
description: 'Release Type (draft=test, final=PyPI)'
74+
description: 'Release Type (determines deployment targets)'
7375
type: string
7476
default: 'draft'
7577
required: false
@@ -157,9 +159,9 @@ jobs:
157159
echo "Release tag: $RELEASE_TAG"
158160
echo "Release type: $RELEASE_TYPE"
159161
160-
# Only enforce strict validation for final releases
161-
if [[ "$RELEASE_TYPE" == "final" ]]; then
162-
echo "Final release detected - applying strict tag validation"
162+
# Only enforce strict validation for PyPI releases
163+
if [[ "$RELEASE_TYPE" == "pypi" ]]; then
164+
echo "PyPI release detected - applying strict tag validation"
163165
164166
# Tag must match semantic versioning: v{major}.{minor}.{patch}[rc{num}]
165167
TAG_REGEX='^v[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?$'
@@ -173,7 +175,7 @@ jobs:
173175
174176
echo "Tag format is valid"
175177
else
176-
echo "Draft release - skipping strict tag validation"
178+
echo "Non-PyPI release - skipping strict tag validation"
177179
echo "Tag accepted: $RELEASE_TAG"
178180
fi
179181
@@ -258,19 +260,19 @@ jobs:
258260
SEMVER_REGEX='^v[0-9]+\.[0-9]+\.[0-9]+$'
259261
260262
# Only push to latest if:
261-
# 1. Release type is final
263+
# 1. Release type is pypi
262264
# 2. Not an RC release
263265
# 3. Tag matches semantic versioning pattern v{major}.{minor}.{patch}
264-
if [[ "$RELEASE_TYPE" == "final" && "$is_rc_release" == "false" && "$RELEASE_TAG" =~ $SEMVER_REGEX ]]; then
266+
if [[ "$RELEASE_TYPE" == "pypi" && "$is_rc_release" == "false" && "$RELEASE_TAG" =~ $SEMVER_REGEX ]]; then
265267
push_to_latest=true
266268
echo "=== Push to Latest ==="
267269
echo "Will push to 'latest' branch in readthedocs"
268-
echo " Conditions met: final release + non-RC + semantic version tag"
270+
echo " Conditions met: pypi release + non-RC + semantic version tag"
269271
else
270272
echo "=== Push to Latest ==="
271273
echo " Will NOT push to 'latest' branch"
272-
if [[ "$RELEASE_TYPE" != "final" ]]; then
273-
echo " Reason: Not a final release (is $RELEASE_TYPE)"
274+
if [[ "$RELEASE_TYPE" != "pypi" ]]; then
275+
echo " Reason: Not a PyPI release (is $RELEASE_TYPE)"
274276
elif [[ "$is_rc_release" == "true" ]]; then
275277
echo " Reason: RC release"
276278
elif [[ ! "$RELEASE_TAG" =~ $SEMVER_REGEX ]]; then
@@ -290,13 +292,13 @@ jobs:
290292
[[ "$CLIENT_TESTS" == "true" ]] && run_client_tests=true
291293
[[ "$CLI_TESTS" == "true" ]] && run_cli_tests=true
292294
293-
# Submodule tests: user input OR auto-enable for final non-RC releases
295+
# Submodule tests: user input OR auto-enable for PyPI non-RC releases
294296
if [[ "$SUBMODULE_TESTS" == "true" ]]; then
295297
run_submodule_tests=true
296298
echo "?? Submodule tests enabled by user input"
297299
elif [[ "$push_to_latest" == "true" ]]; then
298300
run_submodule_tests=true
299-
echo "?? Submodule tests auto-enabled for final non-RC release (push_to_latest=true)"
301+
echo "?? Submodule tests auto-enabled for PyPI non-RC release (push_to_latest=true)"
300302
fi
301303
fi
302304
@@ -334,17 +336,34 @@ jobs:
334336
else
335337
# Automatic defaults based on release_type
336338
echo "Using automatic deployment defaults for release_type: $RELEASE_TYPE"
337-
if [[ "$RELEASE_TYPE" == "final" ]]; then
338-
# Final releases: deploy to production PyPI
339-
deploy_pypi=true
340-
elif [[ "$RELEASE_TYPE" == "draft" ]]; then
341-
# Draft releases: no deployment by default
342-
echo "Draft release - no automatic deployments"
343-
fi
339+
case "$RELEASE_TYPE" in
340+
pypi)
341+
# PyPI releases: deploy to all targets (TestPyPI, PyPI, AWS CodeArtifact)
342+
deploy_testpypi=true
343+
deploy_pypi=true
344+
deploy_aws=true
345+
;;
346+
testpypi)
347+
# TestPyPI releases: deploy to TestPyPI and AWS CodeArtifact
348+
deploy_testpypi=true
349+
deploy_aws=true
350+
;;
351+
codeartifact)
352+
# CodeArtifact only
353+
deploy_aws=true
354+
;;
355+
draft)
356+
# Draft releases: no deployment
357+
echo "Draft release - no automatic deployments"
358+
;;
359+
*)
360+
echo "Unknown release_type: $RELEASE_TYPE - no automatic deployments"
361+
;;
362+
esac
344363
fi
345364
346-
# Sync branches on final releases if deploying to PyPI
347-
if [[ "$RELEASE_TYPE" == "final" && "$deploy_pypi" == "true" ]]; then
365+
# Sync branches on PyPI releases if deploying to PyPI
366+
if [[ "$RELEASE_TYPE" == "pypi" && "$deploy_pypi" == "true" ]]; then
348367
sync_branches=true
349368
fi
350369
fi

0 commit comments

Comments
 (0)