1- name : Test and Release
1+ name : Pre-release Check (Dry Run)
2+
23on :
34 workflow_dispatch :
45 inputs :
56 python-version :
67 description : " Python version to test with (or 'all' for full matrix)"
78 required : false
89 default : " 3.12"
10+ schedule :
11+ - cron : ' 30 3 * * 1' # Monday 9AM IST
912
1013env :
1114 ARTIFACTORY_URL : ${{ vars.ARTIFACTORY_URL }}
1215
1316jobs :
17+ lockfile-hygiene :
18+ runs-on : ubuntu-x64
19+ steps :
20+ - uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
21+ - uses : twilio/sdk-actions/uv-lockfile-hygiene@23b656b843d2a3461cf38e4fd466c07a822d5fc0 # v1
22+ with :
23+ clean-room : ' false'
24+
1425 test :
1526 name : Test - Python ${{ matrix.python-version }}
16- runs-on : ${{ 'ubuntu-x64' }}
17- # github.repository_owner == 'twilio' && 'ubuntu-latest' ||
27+ needs : [lockfile-hygiene]
28+ runs-on : ubuntu-x64
29+ if : github.repository_owner == 'twilio'
1830 timeout-minutes : 20
1931 permissions :
2032 contents : read
2133 id-token : write
2234 strategy :
2335 fail-fast : false
2436 matrix :
25- python-version : ${{ github.event.inputs.python-version == 'all' && fromJson('["3.8","3.9","3.10","3.11","3.12","3.13"]') || fromJson(format('["{0}"]', github.event.inputs.python-version)) }}
37+ python-version : ${{ github.event.inputs.python-version == 'all' && fromJson('["3.8","3.9","3.10","3.11","3.12","3.13"]') || fromJson(format('["{0}"]', github.event.inputs.python-version || '3.12' )) }}
2638 steps :
27- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
39+ - uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2840 with :
2941 fetch-depth : 0
3042
31- - name : Authenticate with Artifactory
32- uses : ./.github/artifactory-oidc
43+ - name : Artifactory OIDC Auth
44+ uses : twilio/sdk-actions/artifactory-oidc@23b656b843d2a3461cf38e4fd466c07a822d5fc0 # v1
45+ with :
46+ ecosystem : python
3347
3448 - uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
3549 with :
@@ -43,21 +57,21 @@ jobs:
4357 - name : Run tests
4458 run : make test-with-coverage
4559
46- deploy :
47- name : Build and Publish to PyPI
60+ deploy-dry-run :
61+ name : Pre-release validation - No Publish
4862 needs : [test]
49- runs-on : ${{ 'ubuntu-x64' }}
50- # runs-on: ${{ github.repository_owner == 'twilio' && 'ubuntu-latest' || 'ubuntu-x64' }}
51- environment : production
63+ runs-on : ubuntu-x64
64+ if : github.repository_owner == 'twilio'
5265 permissions :
5366 contents : read
5467 id-token : write
55- attestations : write
5668 steps :
57- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
69+ - uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
5870
59- - name : Authenticate with Artifactory
60- uses : ./.github/artifactory-oidc
71+ - name : Artifactory OIDC Auth
72+ uses : twilio/sdk-actions/artifactory-oidc@23b656b843d2a3461cf38e4fd466c07a822d5fc0 # v1
73+ with :
74+ ecosystem : python
6175
6276 - uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
6377 with :
@@ -66,18 +80,14 @@ jobs:
6680 - name : Install setuptools
6781 run : pip install setuptools
6882
69- - name : Validate tag matches package version
83+ - name : Validate version format
7084 run : |
7185 PKG_VERSION=$(python setup.py --version)
7286 echo "Package version: $PKG_VERSION"
7387 echo "PKG_VERSION=$PKG_VERSION" >> "$GITHUB_ENV"
74- if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
75- TAG="${GITHUB_REF#refs/tags/}"
76- VERSION="${TAG#v}"
77- if [ "$VERSION" != "$PKG_VERSION" ]; then
78- echo "::error::Tag $TAG does not match setup.py version $PKG_VERSION"
79- exit 1
80- fi
88+ if [[ ! "$PKG_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
89+ echo "::error::setup.py version must follow semver (got '$PKG_VERSION')"
90+ exit 1
8191 fi
8292
8393 - name : Build package
@@ -97,11 +107,8 @@ jobs:
97107 echo ""
98108 echo "Package version: $PKG_VERSION"
99109
100- - name : Publish to PyPI
101- uses : pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1
102-
103- - name : Summary
110+ - name : Dry run summary
104111 run : |
105- echo "--- RELEASE COMPLETE ---"
106- echo "Published version $PKG_VERSION to PyPI "
112+ echo "--- DRY RUN COMPLETE ---"
113+ echo "All pre-release steps passed for version $PKG_VERSION"
107114
0 commit comments