Skip to content

Commit 1fe1f9d

Browse files
committed
♻️ Extract the entire complete workflow about validating release processes as a single reusable workflow to centralized manage.
1 parent d0c2851 commit 1fe1f9d

File tree

2 files changed

+243
-98
lines changed

2 files changed

+243
-98
lines changed
Lines changed: 69 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Release Validation (Dry Run)
2+
# This workflow calls the centralized validation process from the template project
23

34
on:
45
pull_request:
@@ -25,6 +26,33 @@ on:
2526
- patch
2627
- minor
2728
- major
29+
python:
30+
description: 'Python package validation'
31+
required: false
32+
default: 'auto'
33+
type: choice
34+
options:
35+
- auto
36+
- force
37+
- skip
38+
docker:
39+
description: 'Docker image validation'
40+
required: false
41+
default: 'auto'
42+
type: choice
43+
options:
44+
- auto
45+
- force
46+
- skip
47+
docs:
48+
description: 'Documentation validation'
49+
required: false
50+
default: 'auto'
51+
type: choice
52+
options:
53+
- auto
54+
- force
55+
- skip
2856

2957
permissions:
3058
contents: read
@@ -36,119 +64,62 @@ concurrency:
3664
cancel-in-progress: true
3765

3866
jobs:
39-
# Parse project configuration from intent.yaml
40-
config:
41-
name: Parse Configuration
42-
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_parse_project_config.yaml@master
43-
44-
intent-parse:
45-
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_parse_release_intent.yaml@master
46-
needs: config
47-
with:
48-
level: ${{ inputs.level || needs.config.outputs.level }}
49-
python: ${{ needs.config.outputs.python }}
50-
docker: ${{ needs.config.outputs.docker }}
51-
docs: ${{ needs.config.outputs.docs }}
52-
notes: 'Validation test run'
53-
54-
build_git-tag_and_create_github-release:
55-
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_build_git-tag_and_create_github-release_v2.yaml@master
56-
needs: [config, intent-parse]
57-
with:
58-
version: ${{ needs.config.outputs.validation_version }} # Test version for validation
59-
debug_mode: true
60-
secrets:
61-
github_auth_token: ${{ secrets.GITHUB_TOKEN }}
62-
63-
python-build-check:
64-
uses: ./.github/workflows/rw_python_package.yaml
65-
needs: [config, build_git-tag_and_create_github-release]
66-
with:
67-
operation: 'test'
68-
artifact-name: 'validation-python-package'
69-
70-
docker-build-dockerhub:
71-
name: Validate DockerHub Build
72-
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_docker_operations.yaml@master
73-
needs: [config, build_git-tag_and_create_github-release]
67+
# Call the centralized complete validation workflow
68+
validation:
69+
name: Complete Release Validation Process
70+
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_release_validation_complete.yaml@master
7471
with:
75-
operation: 'test'
76-
registry: ${{ needs.config.outputs.docker_registry_dockerhub }}
77-
image-name: ${{ github.repository }}
78-
version: ${{ needs.config.outputs.validation_test_version }}
79-
health-check-port: ${{ needs.config.outputs.docker_health_check_port }}
80-
health-check-path: ${{ needs.config.outputs.docker_health_check_path }}
81-
enable-signing: true
82-
docker-run-options: ${{ needs.config.outputs.docker_run_options }}
83-
84-
docker-build-ghcr:
85-
name: Validate GHCR Build
86-
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_docker_operations.yaml@master
87-
needs: [config, build_git-tag_and_create_github-release]
88-
with:
89-
operation: 'test'
90-
registry: ${{ needs.config.outputs.docker_registry_ghcr }}
91-
image-name: ${{ github.repository }}
92-
version: ${{ needs.config.outputs.validation_test_version }}
93-
health-check-port: ${{ needs.config.outputs.docker_health_check_port }}
94-
health-check-path: ${{ needs.config.outputs.docker_health_check_path }}
95-
enable-signing: true
96-
docker-run-options: ${{ needs.config.outputs.docker_run_options }}
97-
98-
docs-build:
99-
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_docs_operations.yaml@master
100-
needs: [config, intent-parse]
101-
with:
102-
operation: 'test'
103-
upload-artifacts: true
104-
105-
supply-chain-loopback:
106-
name: Security Scan (Supply Chain)
107-
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_docker_operations.yaml@master
108-
needs: [config, docker-build-dockerhub, docker-build-ghcr]
109-
with:
110-
operation: 'security-scan'
111-
registry: ${{ needs.config.outputs.docker_registry_dockerhub }} # Use DockerHub build for security scan
112-
image-name: ${{ github.repository }}
113-
version: ${{ needs.config.outputs.validation_test_version }}
114-
enable-sbom: true
115-
enable-signing: true
116-
docker-run-options: ${{ needs.config.outputs.docker_run_options }}
72+
level: ${{ inputs.level }}
73+
python: ${{ inputs.python }}
74+
docker: ${{ inputs.docker }}
75+
docs: ${{ inputs.docs }}
11776

77+
# Summary job to report results
11878
validation-summary:
11979
name: Validation Summary
12080
runs-on: ubuntu-latest
121-
needs: [config, intent-parse, python-build-check, docker-build-dockerhub, docker-build-ghcr, docs-build, supply-chain-loopback]
81+
needs: validation
12282
if: always()
12383
steps:
124-
- name: Check validation results
84+
- name: Report validation results
12585
run: |
12686
echo "=== Release Validation Summary ==="
12787
echo ""
128-
echo "Intent Parsing: ${{ needs.intent-parse.result }}"
129-
echo "Python Build: ${{ needs.python-build-check.result }}"
130-
echo "DockerHub Build: ${{ needs.docker-build-dockerhub.result }}"
131-
echo "GHCR Build: ${{ needs.docker-build-ghcr.result }}"
132-
echo "Docs Build: ${{ needs.docs-build.result }}"
133-
echo "Supply Chain: ${{ needs.supply-chain-loopback.result }}"
88+
echo "Validation Status: ${{ needs.validation.result }}"
89+
echo "Python Build: ${{ needs.validation.outputs.python_validated }}"
90+
echo "Docker Build: ${{ needs.validation.outputs.docker_validated }}"
91+
echo "Docs Build: ${{ needs.validation.outputs.docs_validated }}"
92+
echo "Security Scan: ${{ needs.validation.outputs.security_validated }}"
93+
echo "Test Version: ${{ needs.validation.outputs.test_version }}"
13494
echo ""
13595
136-
if [[ "${{ needs.intent-parse.result }}" == "success" && \
137-
"${{ needs.python-build-check.result }}" == "success" && \
138-
"${{ needs.docker-build-dockerhub.result }}" == "success" && \
139-
"${{ needs.docker-build-ghcr.result }}" == "success" && \
140-
"${{ needs.docs-build.result }}" == "success" && \
141-
"${{ needs.supply-chain-loopback.result }}" == "success" ]]; then
96+
if [[ "${{ needs.validation.result }}" == "success" && "${{ needs.validation.outputs.validation_passed }}" == "true" ]]; then
14297
echo "✅ All validation checks passed! Release process is ready."
14398
echo ""
144-
echo "Release Configuration:"
145-
echo "- Do Release: ${{ needs.intent-parse.outputs.do_release }}"
146-
echo "- Level: ${{ needs.intent-parse.outputs.level }}"
147-
echo "- Python: ${{ needs.intent-parse.outputs.python }}"
148-
echo "- Docker: ${{ needs.intent-parse.outputs.docker }}"
149-
echo "- Docs: ${{ needs.intent-parse.outputs.docs }}"
150-
echo "- Notes: ${{ needs.intent-parse.outputs.notes }}"
99+
echo "Validation Configuration:"
100+
echo "- Release Intent: ${{ needs.validation.outputs.do_release }}"
101+
echo "- Level: ${{ needs.validation.outputs.level }}"
102+
echo "- Python: ${{ needs.validation.outputs.python }}"
103+
echo "- Docker: ${{ needs.validation.outputs.docker }}"
104+
echo "- Docs: ${{ needs.validation.outputs.docs }}"
105+
echo "- Test Version: ${{ needs.validation.outputs.test_version }}"
106+
echo ""
107+
echo "🚀 The release workflows are ready to deploy!"
151108
else
152109
echo "❌ Some validation checks failed. Please review the logs above."
110+
echo ""
111+
echo "Failed validations need to be addressed before release:"
112+
if [[ "${{ needs.validation.outputs.python_validated }}" != "true" ]]; then
113+
echo "- Python package build/test failed"
114+
fi
115+
if [[ "${{ needs.validation.outputs.docker_validated }}" != "true" ]]; then
116+
echo "- Docker image build/test failed"
117+
fi
118+
if [[ "${{ needs.validation.outputs.docs_validated }}" != "true" ]]; then
119+
echo "- Documentation build/test failed"
120+
fi
121+
if [[ "${{ needs.validation.outputs.security_validated }}" != "true" ]]; then
122+
echo "- Security scan failed"
123+
fi
153124
exit 1
154125
fi
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# Centralized Complete Release Validation Workflow
2+
# This reusable workflow contains all the logic for the release validation process
3+
name: Complete Release Validation Process
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
level:
9+
description: 'Release level to test (auto, patch, minor, major)'
10+
required: false
11+
default: 'auto'
12+
type: string
13+
python:
14+
description: 'Python package validation (auto, force, skip)'
15+
required: false
16+
default: 'auto'
17+
type: string
18+
docker:
19+
description: 'Docker image validation (auto, force, skip)'
20+
required: false
21+
default: 'auto'
22+
type: string
23+
docs:
24+
description: 'Documentation validation (auto, force, skip)'
25+
required: false
26+
default: 'auto'
27+
type: string
28+
outputs:
29+
validation_passed:
30+
description: 'Whether all validation checks passed'
31+
value: ${{ jobs.validation-summary.outputs.success }}
32+
intent_parsed:
33+
description: 'Release intent parsing result'
34+
value: ${{ jobs.intent-parse.result }}
35+
python_validated:
36+
description: 'Python package validation result'
37+
value: ${{ jobs.python-build-check.result }}
38+
docker_validated:
39+
description: 'Docker validation result'
40+
value: ${{ jobs.docker-build-dockerhub.result == 'success' && jobs.docker-build-ghcr.result == 'success' }}
41+
docs_validated:
42+
description: 'Documentation validation result'
43+
value: ${{ jobs.docs-build.result }}
44+
security_validated:
45+
description: 'Security validation result'
46+
value: ${{ jobs.supply-chain-loopback.result }}
47+
48+
permissions:
49+
contents: read
50+
packages: read
51+
id-token: write # For cosign keyless signing
52+
53+
jobs:
54+
# Parse project configuration from intent.yaml
55+
config:
56+
name: Parse Configuration
57+
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_parse_project_config.yaml@master
58+
59+
intent-parse:
60+
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_parse_release_intent.yaml@master
61+
needs: config
62+
with:
63+
level: ${{ inputs.level || needs.config.outputs.level }}
64+
python: ${{ inputs.python || needs.config.outputs.python }}
65+
docker: ${{ inputs.docker || needs.config.outputs.docker }}
66+
docs: ${{ inputs.docs || needs.config.outputs.docs }}
67+
notes: 'Validation test run'
68+
69+
build_git-tag_and_create_github-release:
70+
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_build_git-tag_and_create_github-release_v2.yaml@master
71+
needs: [config, intent-parse]
72+
with:
73+
version: ${{ needs.config.outputs.validation_version }} # Test version for validation
74+
debug_mode: true
75+
secrets:
76+
github_auth_token: ${{ secrets.GITHUB_TOKEN }}
77+
78+
python-build-check:
79+
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_python_package.yaml@master
80+
needs: [config, build_git-tag_and_create_github-release]
81+
with:
82+
operation: 'test'
83+
artifact-name: 'validation-python-package'
84+
85+
docker-build-dockerhub:
86+
name: Validate DockerHub Build
87+
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_docker_operations.yaml@master
88+
needs: [config, build_git-tag_and_create_github-release]
89+
with:
90+
operation: 'test'
91+
registry: ${{ needs.config.outputs.docker_registry_dockerhub }}
92+
image-name: ${{ github.repository }}
93+
version: ${{ needs.config.outputs.validation_test_version }}
94+
health-check-port: ${{ needs.config.outputs.docker_health_check_port }}
95+
health-check-path: ${{ needs.config.outputs.docker_health_check_path }}
96+
enable-signing: true
97+
docker-run-options: ${{ needs.config.outputs.docker_run_options }}
98+
99+
docker-build-ghcr:
100+
name: Validate GHCR Build
101+
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_docker_operations.yaml@master
102+
needs: [config, build_git-tag_and_create_github-release]
103+
with:
104+
operation: 'test'
105+
registry: ${{ needs.config.outputs.docker_registry_ghcr }}
106+
image-name: ${{ github.repository }}
107+
version: ${{ needs.config.outputs.validation_test_version }}
108+
health-check-port: ${{ needs.config.outputs.docker_health_check_port }}
109+
health-check-path: ${{ needs.config.outputs.docker_health_check_path }}
110+
enable-signing: true
111+
docker-run-options: ${{ needs.config.outputs.docker_run_options }}
112+
113+
docs-build:
114+
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_docs_operations.yaml@master
115+
needs: [config, intent-parse]
116+
with:
117+
operation: 'test'
118+
upload-artifacts: true
119+
120+
supply-chain-loopback:
121+
name: Security Scan (Supply Chain)
122+
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_docker_operations.yaml@master
123+
needs: [config, docker-build-dockerhub, docker-build-ghcr]
124+
with:
125+
operation: 'security-scan'
126+
registry: ${{ needs.config.outputs.docker_registry_dockerhub }} # Use DockerHub build for security scan
127+
image-name: ${{ github.repository }}
128+
version: ${{ needs.config.outputs.validation_test_version }}
129+
enable-sbom: true
130+
enable-signing: true
131+
docker-run-options: ${{ needs.config.outputs.docker_run_options }}
132+
133+
validation-summary:
134+
name: Validation Summary
135+
runs-on: ubuntu-latest
136+
needs: [config, intent-parse, python-build-check, docker-build-dockerhub, docker-build-ghcr, docs-build, supply-chain-loopback]
137+
if: always()
138+
outputs:
139+
success: ${{ steps.summary.outputs.success }}
140+
steps:
141+
- name: Check validation results
142+
id: summary
143+
run: |
144+
echo "=== Release Validation Summary ==="
145+
echo ""
146+
echo "Intent Parsing: ${{ needs.intent-parse.result }}"
147+
echo "Python Build: ${{ needs.python-build-check.result }}"
148+
echo "DockerHub Build: ${{ needs.docker-build-dockerhub.result }}"
149+
echo "GHCR Build: ${{ needs.docker-build-ghcr.result }}"
150+
echo "Docs Build: ${{ needs.docs-build.result }}"
151+
echo "Supply Chain: ${{ needs.supply-chain-loopback.result }}"
152+
echo ""
153+
154+
if [[ "${{ needs.intent-parse.result }}" == "success" && \
155+
"${{ needs.python-build-check.result }}" == "success" && \
156+
"${{ needs.docker-build-dockerhub.result }}" == "success" && \
157+
"${{ needs.docker-build-ghcr.result }}" == "success" && \
158+
"${{ needs.docs-build.result }}" == "success" && \
159+
"${{ needs.supply-chain-loopback.result }}" == "success" ]]; then
160+
echo "✅ All validation checks passed! Release process is ready."
161+
echo "success=true" >> $GITHUB_OUTPUT
162+
echo ""
163+
echo "Release Configuration:"
164+
echo "- Do Release: ${{ needs.intent-parse.outputs.do_release }}"
165+
echo "- Level: ${{ needs.intent-parse.outputs.level }}"
166+
echo "- Python: ${{ needs.intent-parse.outputs.python }}"
167+
echo "- Docker: ${{ needs.intent-parse.outputs.docker }}"
168+
echo "- Docs: ${{ needs.intent-parse.outputs.docs }}"
169+
echo "- Notes: ${{ needs.intent-parse.outputs.notes }}"
170+
else
171+
echo "❌ Some validation checks failed. Please review the logs above."
172+
echo "success=false" >> $GITHUB_OUTPUT
173+
exit 1
174+
fi

0 commit comments

Comments
 (0)