11name : Staging Release
2+ # This workflow calls the centralized staging release process from the template project
23
34on :
45 workflow_dispatch :
@@ -23,162 +24,54 @@ concurrency:
2324 cancel-in-progress : false
2425
2526jobs :
26- # Parse project configuration from intent.yaml
27- config :
28- name : Parse Configuration
29- uses : Chisanan232/Template-Python-UV-Project/.github/workflows/rw_parse_project_config.yaml@master
30-
31- compute-version :
32- name : Compute Staging Version
33- runs-on : ubuntu-latest
34- needs : config
35- outputs :
36- version : ${{ steps.version.outputs.version }}
37- rc_version : ${{ steps.version.outputs.rc_version }}
38- steps :
39- - name : Checkout repository
40- uses : actions/checkout@v5
41- with :
42- fetch-depth : 0
43- # Only use ref for push events to master to get latest commit after version bump
44- # In PR events, github.ref_name gives merge refs like "109/merge" which breaks checkout
45- ref : ${{ github.event_name == 'push' && github.ref_name == 'master' && github.ref_name || '' }}
46-
47- - name : Setup Python with UV
48- uses : Chisanan232/Template-Python-UV-Project/.github/actions/setup-python-uv@master
49- with :
50- install-dependencies : ' true'
51- dependency-groups : ' release-ci'
52-
53- - name : Compute staging version
54- id : version
55- run : |
56- case "${{ inputs.level }}" in
57- "patch")
58- BUMP_FLAG="--bump patch"
59- ;;
60- "minor")
61- BUMP_FLAG="--bump minor"
62- ;;
63- "major")
64- BUMP_FLAG="--bump major"
65- ;;
66- *)
67- BUMP_FLAG="--bump patch"
68- ;;
69- esac
70-
71- echo "Computing staging version with: uv version --dry-run $BUMP_FLAG"
72- BASE_VERSION=$(uv version --short --dry-run $BUMP_FLAG)
73- RC_VERSION="${BASE_VERSION}-rc.0"
74-
75- echo "version=$BASE_VERSION" >> $GITHUB_OUTPUT
76- echo "rc_version=$RC_VERSION" >> $GITHUB_OUTPUT
77-
78- echo "Base version: $BASE_VERSION"
79- echo "RC version: $RC_VERSION"
80-
81- build_git-tag_and_create_github-release :
82- uses : Chisanan232/Template-Python-UV-Project/.github/workflows/rw_build_git-tag_and_create_github-release_v2.yaml@master
83- needs : [config, compute-version]
27+ # Call the centralized complete staging release workflow
28+ staging :
29+ name : Complete Staging Release Process
30+ uses : Chisanan232/Template-Python-UV-Project/.github/workflows/rw_release_staging_complete.yaml@master
8431 with :
85- version : ${{ needs.compute-version.outputs.rc_version }}
86- checkout-sha : ${{ github.sha }}
87- debug_mode : true
32+ level : ${{ inputs.level }}
8833 secrets :
89- github_auth_token : ${{ secrets.GITHUB_TOKEN }}
90-
91- pypi-test :
92- uses : ./.github/workflows/rw_python_package.yaml
93- needs : [config, compute-version, build_git-tag_and_create_github-release]
94- with :
95- operation : ' publish-testpypi'
96- version : ${{ needs.compute-version.outputs.version }}
97- checkout-sha : ${{ github.sha }}
98- artifact-name : ' staging-python-package'
99-
100- dockerhub-rc :
101- name : Staging Release to DockerHub
102- uses : Chisanan232/Template-Python-UV-Project/.github/workflows/rw_docker_operations.yaml@master
103- needs : [config, compute-version, build_git-tag_and_create_github-release]
104- secrets :
105- dockerhub-user : ${{ secrets.DOCKERHUB_USERNAME }}
106- registry-token : ${{ secrets.DOCKERHUB_TOKEN }}
107- with :
108- operation : ' push'
109- registry : ${{ needs.config.outputs.docker_registry_dockerhub }}
110- version : ${{ needs.compute-version.outputs.rc_version }}
111- checkout-sha : ${{ github.sha }}
112- enable-sbom : true
113- enable-signing : true
114- health-check-port : ${{ needs.config.outputs.docker_health_check_port }}
115- health-check-path : ${{ needs.config.outputs.docker_health_check_path }}
116- docker-run-options : ${{ needs.config.outputs.docker_run_options }}
117-
118- ghcr-rc :
119- name : Staging Release to GHCR
120- uses : Chisanan232/Template-Python-UV-Project/.github/workflows/rw_docker_operations.yaml@master
121- needs : [config, compute-version, build_git-tag_and_create_github-release]
122- with :
123- operation : ' push'
124- registry : ${{ needs.config.outputs.docker_registry_ghcr }}
125- version : ${{ needs.compute-version.outputs.rc_version }}
126- checkout-sha : ${{ github.sha }}
127- enable-sbom : true
128- enable-signing : true
129- health-check-port : ${{ needs.config.outputs.docker_health_check_port }}
130- health-check-path : ${{ needs.config.outputs.docker_health_check_path }}
131- docker-run-options : ${{ needs.config.outputs.docker_run_options }}
132-
133- docs-preview :
134- uses : Chisanan232/Template-Python-UV-Project/.github/workflows/rw_docs_operations.yaml@master
135- needs : [config, compute-version]
136- with :
137- operation : ' deploy-preview'
138- version : ${{ needs.compute-version.outputs.rc_version }}
139- checkout-sha : ${{ github.sha }}
140- preview-branch : ${{ needs.config.outputs.docs_preview_branch }}
141- upload-artifacts : true
34+ DOCKERHUB_USERNAME : ${{ secrets.DOCKERHUB_USERNAME }}
35+ DOCKERHUB_TOKEN : ${{ secrets.DOCKERHUB_TOKEN }}
14236
37+ # Summary job to report results
14338 staging-summary :
14439 name : Staging Release Summary
14540 runs-on : ubuntu-latest
146- needs : [config, compute-version, pypi-test, ghcr-rc, docs-preview]
41+ needs : staging
14742 if : always()
14843 steps :
149- - name : Generate staging release summary
44+ - name : Report staging results
15045 run : |
15146 echo "=== Staging Release Summary ==="
15247 echo ""
153- echo "Version Computation: ${{ needs.compute-version.result }}"
154- echo "TestPyPI Upload: ${{ needs.pypi-test.result }}"
155- echo "GHCR RC Image: ${{ needs.ghcr-rc.result }}"
156- echo "Docs Preview: ${{ needs.docs-preview.result }}"
157- echo ""
158- echo "📦 Staging Artifacts:"
159- echo "- Base Version: ${{ needs.compute-version.outputs.version }}"
160- echo "- RC Version: ${{ needs.compute-version.outputs.rc_version }}"
161- echo "- TestPyPI: https://test.pypi.org/project/${{ needs.config.outputs.project_name }}/${{ needs.compute-version.outputs.version }}/"
162- echo "- GHCR RC Image: ghcr.io/${{ github.repository }}:${{ needs.compute-version.outputs.rc_version }}"
163- echo "- Docs Preview: docs-preview branch"
48+ echo "Staging Status: ${{ needs.staging.result }}"
49+ echo "Base Version: ${{ needs.staging.outputs.version }}"
50+ echo "RC Version: ${{ needs.staging.outputs.rc_version }}"
51+ echo "Staging Completed: ${{ needs.staging.outputs.staging_completed }}"
16452 echo ""
16553
166- if [[ "${{ needs.compute-version.result }}" == "success" && \
167- "${{ needs.pypi-test.result }}" == "success" && \
168- "${{ needs.ghcr-rc.result }}" == "success" && \
169- "${{ needs.docs-preview.result }}" == "success" ]]; then
170- echo "✅ Staging release completed successfully!"
54+ if [[ "${{ needs.staging.result }}" == "success" && "${{ needs.staging.outputs.staging_completed }}" == "true" ]]; then
55+ echo "🎉 Staging release completed successfully!"
56+ echo ""
57+ echo "📦 Staging Artifacts:"
58+ echo "- Base Version: ${{ needs.staging.outputs.version }}"
59+ echo "- RC Version: ${{ needs.staging.outputs.rc_version }}"
60+ echo "- TestPyPI: https://test.pypi.org/project/${{ github.repository_owner }}/${{ needs.staging.outputs.version }}/"
61+ echo "- GHCR RC Image: ghcr.io/${{ github.repository }}:${{ needs.staging.outputs.rc_version }}"
62+ echo "- DockerHub RC Image: docker.io/${{ github.repository }}:${{ needs.staging.outputs.rc_version }}"
63+ echo "- Docs Preview: docs-preview branch"
17164 echo ""
17265 echo "🧪 Testing Instructions:"
17366 echo "1. Install from TestPyPI:"
174- echo " pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ ${{ needs.config.outputs.project_name }}==${{ needs.compute-version .outputs.version }}"
67+ echo " pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ ${{ github.repository_owner }}==${{ needs.staging .outputs.version }}"
17568 echo ""
17669 echo "2. Test RC Docker image:"
177- echo " docker run -p ${{ needs.config.outputs.docker_health_check_port }}:${{ needs.config.outputs.docker_health_check_port }} -e ${{ needs.config.outputs.docker_app_env_var_name }}=${{ needs.config.outputs.docker_app_env_var_value }} ghcr.io/${{ github.repository }}:${{ needs.compute-version .outputs.rc_version }}"
70+ echo " docker run -p 8000:8000 ghcr.io/${{ github.repository }}:${{ needs.staging .outputs.rc_version }}"
17871 echo ""
17972 echo "3. Review documentation preview in docs-preview branch"
18073 echo ""
18174 else
182- echo "❌ Some staging deployment steps failed. Check the logs above."
75+ echo "❌ Staging process failed. Check the workflow logs above."
18376 exit 1
18477 fi
0 commit comments