Skip to content

Commit 62a34b8

Browse files
committed
Changed ids
1 parent 02ae7c9 commit 62a34b8

File tree

3 files changed

+26
-56
lines changed

3 files changed

+26
-56
lines changed

.github/workflows/child-workflow-1.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ jobs:
3636
run: |
3737
echo "Generating test report..."
3838
mkdir -p test-results
39-
echo "Test Summary: 25 tests passed, 0 failed" > test-results/summary.txt
39+
echo ${{ inputs.artifact_id }} > child1.txt
4040
4141
- name: Upload test results
4242
uses: actions/upload-artifact@v4
4343
with:
44-
name: test-results-${{ inputs.artifact_id }}
44+
name: ${{ inputs.artifact_id }}
4545
path: test-results/

.github/workflows/child-workflow-2.yml

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,10 @@ jobs:
2727
sleep 4
2828
echo "Build completed successfully"
2929
mkdir -p build
30-
echo "Built application v1.0.0" > build/version.txt
30+
echo ${{ inputs.artifact_id }} > child2.txt
3131
3232
- name: Upload build artifacts
3333
uses: actions/upload-artifact@v4
3434
with:
35-
name: build-artifacts-${{ inputs.artifact_id }}
35+
name: ${{ inputs.artifact_id }}
3636
path: build/
37-
38-
security-scan:
39-
runs-on: ubuntu-latest
40-
steps:
41-
- name: Checkout code
42-
uses: actions/checkout@v4
43-
44-
- name: Run security scan
45-
run: |
46-
echo "Running security vulnerability scan..."
47-
sleep 3
48-
echo "Security scan completed - no vulnerabilities found"
49-
50-
- name: Generate security report
51-
run: |
52-
echo "Generating security report..."
53-
mkdir -p security-results
54-
echo "Security Status: PASS - No vulnerabilities detected" > security-results/security-report.txt
55-
56-
- name: Upload security results
57-
uses: actions/upload-artifact@v4
58-
with:
59-
name: security-results-${{ inputs.artifact_id }}
60-
path: security-results/

.github/workflows/parent-workflow.yml

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ jobs:
1616
name: "Execute Test Suite"
1717
uses: ./.github/workflows/child-workflow-1.yml
1818
with:
19-
artifact_id: "child1"
19+
artifact_id: "child1-${{ github.ref_name }}-${{ github.sha }}"
2020

2121
run-build-security:
2222
name: "Execute Build & Security Checks"
2323
uses: ./.github/workflows/child-workflow-2.yml
2424
with:
25-
artifact_id: "child2"
25+
artifact_id: "child2-${{ github.ref_name }}-${{ github.sha }}"
2626

2727
# Parent workflow job that runs after both children complete
2828
collect-and-deploy:
@@ -50,46 +50,40 @@ jobs:
5050
5151
echo "✅ All child workflows completed successfully!"
5252
53-
- name: Download all artifacts from child workflows
54-
uses: actions/download-artifact@v4
53+
54+
- name: Download test artifacts from child workflow 1
55+
uses: actions/download-artifact@v4.1.8
5556
with:
56-
path: combined-artifacts/
57+
name: "test-results-child1-${{ github.ref_name }}-${{ github.sha }}"
58+
path: artifacts/
5759

58-
- name: Process and combine results
59-
run: |
60-
echo "Processing combined results from child workflows..."
61-
ls -la combined-artifacts/
62-
63-
echo "=== Test Results ==="
64-
if [ -f "combined-artifacts/test-results-child1/summary.txt" ]; then
65-
cat combined-artifacts/test-results-child1/summary.txt
66-
fi
67-
68-
echo "=== Build Artifacts ==="
69-
if [ -f "combined-artifacts/build-artifacts-child2/version.txt" ]; then
70-
cat combined-artifacts/build-artifacts-child2/version.txt
71-
fi
72-
73-
echo "=== Security Results ==="
74-
if [ -f "combined-artifacts/security-results-child2/security-report.txt" ]; then
75-
cat combined-artifacts/security-results-child2/security-report.txt
76-
fi
60+
- name: Download build and security artifacts from child workflow 2
61+
uses: actions/download-artifact@v4.1.8
62+
with:
63+
name: "build-artifacts-child2-${{ github.ref_name }}-${{ github.sha }}"
64+
path: artifacts/
65+
66+
- name: Download security artifacts from child workflow 2
67+
uses: actions/download-artifact@v4.1.8
68+
with:
69+
name: "security-results-child2-${{ github.ref_name }}-${{ github.sha }}"
70+
path: artifacts/
7771

7872
- name: Create deployment package
7973
run: |
8074
echo "Creating deployment package..."
8175
mkdir -p deployment
8276
echo "Deployment ready - $(date)" > deployment/deployment-info.txt
8377
84-
# Copy relevant artifacts to deployment folder
85-
if [ -d "combined-artifacts/build-artifacts-child2" ]; then
86-
cp -r combined-artifacts/build-artifacts-child2/* deployment/
78+
# Copy all artifacts to deployment folder
79+
if [ -d "artifacts" ]; then
80+
cp -r artifacts/* deployment/
8781
fi
8882
8983
- name: Upload final deployment artifacts
9084
uses: actions/upload-artifact@v4
9185
with:
92-
name: deployment-package
86+
name: "deployment-package-${{ github.ref_name }}-${{ github.sha }}"
9387
path: deployment/
9488

9589
- name: Deployment simulation

0 commit comments

Comments
 (0)