-
Notifications
You must be signed in to change notification settings - Fork 178
137 lines (122 loc) ยท 4.49 KB
/
workflow-controller.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: '๐ฎ Workflow Controller'
on:
workflow_dispatch: # Manual trigger
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
jobs:
checkout:
runs-on: ubuntu-latest
steps:
- name: ๐ฅ Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# Quality Check Jobs (Run on PRs and Pushes)
structure-check:
needs: checkout
uses: ./.github/workflows/structure-check.yml
link-check:
needs: checkout
uses: ./.github/workflows/link-check.yml
lint-markdown:
needs: checkout
uses: ./.github/workflows/lint-markdown.yml
# Metadata Update Jobs (Run Only After Merge to dev)
update-changelog:
needs: [structure-check, link-check, lint-markdown]
uses: ./.github/workflows/update-changelog.yml
update-contributors:
needs: [structure-check, link-check, lint-markdown]
uses: ./.github/workflows/update-contributors.yml
# Build Jobs
build-dev:
name: ๐ง Development Build
if: github.ref == 'refs/heads/dev'
needs: [update-changelog, update-contributors]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
uses: ./.github/workflows/quarto-build.yml
with:
environment: development
os: ${{ matrix.os }}
target: dev
secrets:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
build-main:
name: ๐ Production Build
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: [update-changelog, update-contributors]
uses: ./.github/workflows/quarto-build.yml
with:
environment: production
os: ubuntu-latest
target: main
secrets:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
# Status Reporting
report-status:
needs: [
structure-check,
link-check,
lint-markdown,
update-changelog,
update-contributors,
build-main,
build-dev
]
if: always()
runs-on: ubuntu-latest
steps:
- name: ๐ Create Status Report
run: |
{
echo "# ๐ Workflow Status Report"
echo
echo "## ๐ Quality Checks"
echo "- Structure Check: ${{ needs.structure-check.result == 'success' && 'โ
Passed' || 'โ Failed' }}"
echo "- Link Check: ${{ needs.link-check.result == 'success' && 'โ
Passed' || 'โ Failed' }}"
echo "- Markdown Lint: ${{ needs.lint-markdown.result == 'success' && 'โ
Passed' || 'โ Failed' }}"
echo
echo "## ๐ Metadata Updates"
echo "- Changelog: ${{ needs.update-changelog.result == 'success' && 'โ
Updated' || 'โ Failed' }}"
echo "- Contributors: ${{ needs.update-contributors.result == 'success' && 'โ
Updated' || 'โ Failed' }}"
echo
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "## ๐ Production Build"
echo "- Main Build: ${{ needs.build-main.result == 'success' && 'โ
Success' || 'โ Failed' }}"
fi
if [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
echo "## ๐ง Development Build"
echo "- Dev Build: ${{ needs.build-dev.result == 'success' && 'โ
Success' || 'โ Failed' }}"
fi
echo
echo "---"
echo "โฐ Completed at: $(date '+%Y-%m-%d %H:%M:%S')"
} >> $GITHUB_STEP_SUMMARY
- name: ๐ Check Overall Status
if: always()
run: |
FAILED=0
# Check quality checks
[[ "${{ needs.structure-check.result }}" != "success" ]] && FAILED=1
[[ "${{ needs.link-check.result }}" != "success" ]] && FAILED=1
[[ "${{ needs.lint-markdown.result }}" != "success" ]] && FAILED=1
# Check metadata updates
[[ "${{ needs.update-changelog.result }}" != "success" ]] && FAILED=1
[[ "${{ needs.update-contributors.result }}" != "success" ]] && FAILED=1
# Check builds based on branch
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
[[ "${{ needs.build-main.result }}" != "success" ]] && FAILED=1
fi
if [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
[[ "${{ needs.build-dev.result }}" != "success" ]] && FAILED=1
fi
if [[ $FAILED -eq 1 ]]; then
echo "::error::โ One or more workflow steps failed"
exit 1
else
echo "โ
All checks passed successfully"
fi