@hybridlabor-api/aos 4.8.0 → 4.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/.agents/{agents.md → AGENTS.md} +3 -1
  2. package/.agents/nodes.json +3 -1
  3. package/.agents/vendor-manifest.json +23 -1
  4. package/.claude/agents/godmode-media-eventtech.md +1 -1
  5. package/.claude/hooks/conventional-commits.mjs +125 -0
  6. package/.claude/hooks/env-file-protection.mjs +105 -0
  7. package/.claude/hooks/go-gate.mjs +101 -81
  8. package/.claude/hooks/memb-inject.mjs +29 -1
  9. package/.claude/settings.json +13 -0
  10. package/.claude/workflows/startcycle-dispatch.mjs +23 -1
  11. package/.opencode/agents/godmode-media-eventtech.md +1 -1
  12. package/.opencode/plugins/bdb-aos.js +31 -4
  13. package/CLAUDE.md +0 -571
  14. package/README.de.md +1 -1
  15. package/README.md +1 -1
  16. package/README.pt.md +1 -1
  17. package/THIRD_PARTY_NOTICES.md +126 -0
  18. package/bin/aos-doctor.mjs +1 -1
  19. package/docs/skills_table.md +1 -1
  20. package/installer.js +187 -55
  21. package/package.json +7 -3
  22. package/packages/aos-cli/README.md +80 -0
  23. package/packages/aos-cli/bin/aos-cli.mjs +134 -0
  24. package/packages/aos-cli/core-skills.json +12 -0
  25. package/packages/aos-cli/extensions/aos.ts +321 -0
  26. package/packages/aos-cli/package-lock.json +1923 -0
  27. package/packages/aos-cli/package.json +29 -0
  28. package/packages/aos-cli/scripts/check-theme.mjs +63 -0
  29. package/packages/aos-cli/themes/aos.json +97 -0
  30. package/scripts/build-plugin-manifest.mjs +131 -0
  31. package/scripts/validate-skills.mjs +81 -6
  32. package/skills/basic/ao-orchestrator/SKILL.md +116 -0
  33. package/skills/basic/bdb-eventagency-skill/SKILL.md +252 -0
  34. package/skills/basic/bdb-shipping-skill/SKILL.md +161 -0
  35. package/skills/basic/godmode-eventtech/SKILL.md +4 -1
  36. package/skills/global_config/agenttrail/SKILL.md +6 -1
  37. package/skills/global_config/aos-project-init/SKILL.md +2 -0
  38. package/skills/global_config/aos-project-init/assets/AGENTS.template.md +1 -1
  39. package/skills/global_config/aos-project-init/scripts/aos-project-doctor.mjs +1 -1
  40. package/skills/global_config/aos-setup/SKILL.md +1 -1
  41. package/skills/global_config/aos-setup/scripts/aos-doctor.mjs +1 -1
  42. package/skills/global_config/ask-tim/SKILL.md +7 -7
  43. package/skills/global_config/bash-script-generator/SKILL.md +201 -0
  44. package/skills/global_config/bash-script-generator/assets/templates/standard-template.sh +96 -0
  45. package/skills/global_config/bash-script-generator/docs/bash-scripting-guide.md +729 -0
  46. package/skills/global_config/bash-script-generator/docs/generation-best-practices.md +193 -0
  47. package/skills/global_config/bash-script-generator/docs/script-patterns.md +566 -0
  48. package/skills/global_config/bash-script-generator/docs/text-processing-guide.md +437 -0
  49. package/skills/global_config/bash-script-generator/examples/log-analyzer.sh +92 -0
  50. package/skills/global_config/bash-script-generator/scripts/generate_script_template.sh +123 -0
  51. package/skills/global_config/bash-script-generator/scripts/run_ci_checks.sh +172 -0
  52. package/skills/global_config/bash-script-generator/scripts/test_generator.sh +413 -0
  53. package/skills/global_config/bash-script-validator/SKILL.md +249 -0
  54. package/skills/global_config/bash-script-validator/docs/awk-reference.md +449 -0
  55. package/skills/global_config/bash-script-validator/docs/bash-reference.md +468 -0
  56. package/skills/global_config/bash-script-validator/docs/common-mistakes.md +623 -0
  57. package/skills/global_config/bash-script-validator/docs/grep-reference.md +395 -0
  58. package/skills/global_config/bash-script-validator/docs/regex-reference.md +391 -0
  59. package/skills/global_config/bash-script-validator/docs/sed-reference.md +454 -0
  60. package/skills/global_config/bash-script-validator/docs/shell-reference.md +463 -0
  61. package/skills/global_config/bash-script-validator/docs/shellcheck-reference.md +399 -0
  62. package/skills/global_config/bash-script-validator/examples/bad-bash.sh +55 -0
  63. package/skills/global_config/bash-script-validator/examples/bad-shell.sh +54 -0
  64. package/skills/global_config/bash-script-validator/examples/good-bash.sh +71 -0
  65. package/skills/global_config/bash-script-validator/examples/good-shell.sh +69 -0
  66. package/skills/global_config/bash-script-validator/scripts/run_ci_checks.sh +23 -0
  67. package/skills/global_config/bash-script-validator/scripts/shellcheck_wrapper.sh +174 -0
  68. package/skills/global_config/bash-script-validator/scripts/test_validate.sh +446 -0
  69. package/skills/global_config/bash-script-validator/scripts/validate.sh +512 -0
  70. package/skills/global_config/ci-pipeline/SKILL.md +135 -0
  71. package/skills/global_config/deja-memory/SKILL.md +3 -1
  72. package/skills/global_config/dispatching-parallel-agents/SKILL.md +170 -0
  73. package/skills/global_config/dockerfile-generator/SKILL.md +1038 -0
  74. package/skills/global_config/dockerfile-generator/examples/example.dockerignore +95 -0
  75. package/skills/global_config/dockerfile-generator/examples/golang-distroless.Dockerfile +34 -0
  76. package/skills/global_config/dockerfile-generator/examples/java-springboot.Dockerfile +45 -0
  77. package/skills/global_config/dockerfile-generator/examples/nextjs-production.Dockerfile +49 -0
  78. package/skills/global_config/dockerfile-generator/examples/nodejs-multistage.Dockerfile +55 -0
  79. package/skills/global_config/dockerfile-generator/examples/python-fastapi.Dockerfile +48 -0
  80. package/skills/global_config/dockerfile-generator/references/language_specific_guides.md +510 -0
  81. package/skills/global_config/dockerfile-generator/references/multistage_builds.md +570 -0
  82. package/skills/global_config/dockerfile-generator/references/optimization_patterns.md +492 -0
  83. package/skills/global_config/dockerfile-generator/references/security_best_practices.md +375 -0
  84. package/skills/global_config/dockerfile-generator/scripts/generate_dockerignore.sh +199 -0
  85. package/skills/global_config/dockerfile-generator/scripts/generate_golang.sh +172 -0
  86. package/skills/global_config/dockerfile-generator/scripts/generate_java.sh +185 -0
  87. package/skills/global_config/dockerfile-generator/scripts/generate_nodejs.sh +279 -0
  88. package/skills/global_config/dockerfile-generator/scripts/generate_python.sh +218 -0
  89. package/skills/global_config/dockerfile-generator/scripts/test_generator.sh +210 -0
  90. package/skills/global_config/dockerfile-validator/SKILL.md +300 -0
  91. package/skills/global_config/dockerfile-validator/examples/.dockerignore.example +34 -0
  92. package/skills/global_config/dockerfile-validator/examples/bad-example.Dockerfile +37 -0
  93. package/skills/global_config/dockerfile-validator/examples/golang-distroless.Dockerfile +50 -0
  94. package/skills/global_config/dockerfile-validator/examples/good-example.Dockerfile +52 -0
  95. package/skills/global_config/dockerfile-validator/examples/python-optimized.Dockerfile +53 -0
  96. package/skills/global_config/dockerfile-validator/examples/security-issues.Dockerfile +42 -0
  97. package/skills/global_config/dockerfile-validator/references/docker_best_practices.md +348 -0
  98. package/skills/global_config/dockerfile-validator/references/optimization_guide.md +473 -0
  99. package/skills/global_config/dockerfile-validator/references/security_checklist.md +208 -0
  100. package/skills/global_config/dockerfile-validator/scripts/dockerfile-validate.sh +699 -0
  101. package/skills/global_config/dockerfile-validator/scripts/test_validate.sh +35 -0
  102. package/skills/global_config/dockerfile-validator/tests/fixtures/copy-before-yarn-lock-read.Dockerfile +6 -0
  103. package/skills/global_config/dockerfile-validator/tests/fixtures/copy-before-yarn.Dockerfile +6 -0
  104. package/skills/global_config/dockerfile-validator/tests/fixtures/from-platform-nonroot.Dockerfile +7 -0
  105. package/skills/global_config/dockerfile-validator/tests/test_regression.sh +164 -0
  106. package/skills/global_config/finishing-a-development-branch/SKILL.md +228 -0
  107. package/skills/global_config/github-actions-generator/SKILL.md +353 -0
  108. package/skills/global_config/github-actions-generator/assets/templates/action/composite/action.yml +82 -0
  109. package/skills/global_config/github-actions-generator/assets/templates/action/docker/Dockerfile +25 -0
  110. package/skills/global_config/github-actions-generator/assets/templates/action/docker/action.yml +42 -0
  111. package/skills/global_config/github-actions-generator/assets/templates/action/docker/entrypoint.sh +27 -0
  112. package/skills/global_config/github-actions-generator/assets/templates/action/javascript/action.yml +33 -0
  113. package/skills/global_config/github-actions-generator/assets/templates/action/javascript/index.js +50 -0
  114. package/skills/global_config/github-actions-generator/assets/templates/action/javascript/package.json +27 -0
  115. package/skills/global_config/github-actions-generator/assets/templates/workflow/basic_workflow.yml +242 -0
  116. package/skills/global_config/github-actions-generator/assets/templates/workflow/reusable_workflow.yml +106 -0
  117. package/skills/global_config/github-actions-generator/examples/README.md +147 -0
  118. package/skills/global_config/github-actions-generator/examples/actions/setup-node-cached/action.yml +93 -0
  119. package/skills/global_config/github-actions-generator/examples/caching/docker-buildkit.yml +256 -0
  120. package/skills/global_config/github-actions-generator/examples/security/dependency-review.yml +62 -0
  121. package/skills/global_config/github-actions-generator/examples/security/sbom-attestation.yml +119 -0
  122. package/skills/global_config/github-actions-generator/examples/triggers/chatops-commands.yml +475 -0
  123. package/skills/global_config/github-actions-generator/examples/triggers/repository-dispatch.yml +418 -0
  124. package/skills/global_config/github-actions-generator/examples/triggers/workflow-orchestration.yml +404 -0
  125. package/skills/global_config/github-actions-generator/examples/workflows/docker-build-push.yml +68 -0
  126. package/skills/global_config/github-actions-generator/examples/workflows/go-ci.yml +161 -0
  127. package/skills/global_config/github-actions-generator/examples/workflows/monorepo-ci.yml +340 -0
  128. package/skills/global_config/github-actions-generator/examples/workflows/multi-environment-deploy.yml +406 -0
  129. package/skills/global_config/github-actions-generator/examples/workflows/nodejs-ci.yml +122 -0
  130. package/skills/global_config/github-actions-generator/examples/workflows/python-ci.yml +157 -0
  131. package/skills/global_config/github-actions-generator/examples/workflows/scheduled-tasks.yml +376 -0
  132. package/skills/global_config/github-actions-generator/references/advanced-triggers.md +917 -0
  133. package/skills/global_config/github-actions-generator/references/best-practices.md +755 -0
  134. package/skills/global_config/github-actions-generator/references/common-actions.md +715 -0
  135. package/skills/global_config/github-actions-generator/references/custom-actions.md +320 -0
  136. package/skills/global_config/github-actions-generator/references/expressions-and-contexts.md +688 -0
  137. package/skills/global_config/github-actions-generator/references/modern-features.md +421 -0
  138. package/skills/global_config/github-actions-generator/scripts/test_generator.sh +344 -0
  139. package/skills/global_config/github-actions-templates/SKILL.md +7 -0
  140. package/skills/global_config/github-actions-validator/SKILL.md +576 -0
  141. package/skills/global_config/github-actions-validator/examples/README.md +88 -0
  142. package/skills/global_config/github-actions-validator/examples/outdated-versions.yml +76 -0
  143. package/skills/global_config/github-actions-validator/examples/valid-ci.yml +79 -0
  144. package/skills/global_config/github-actions-validator/examples/with-errors.yml +47 -0
  145. package/skills/global_config/github-actions-validator/references/act_usage.md +233 -0
  146. package/skills/global_config/github-actions-validator/references/action_versions.md +122 -0
  147. package/skills/global_config/github-actions-validator/references/actionlint_usage.md +343 -0
  148. package/skills/global_config/github-actions-validator/references/common_errors.md +512 -0
  149. package/skills/global_config/github-actions-validator/references/modern_features.md +384 -0
  150. package/skills/global_config/github-actions-validator/references/runners.md +317 -0
  151. package/skills/global_config/github-actions-validator/scripts/install_tools.sh +113 -0
  152. package/skills/global_config/github-actions-validator/scripts/validate_workflow.sh +910 -0
  153. package/skills/global_config/github-actions-validator/tests/test_validate_workflow.sh +237 -0
  154. package/skills/global_config/makefile-generator/SKILL.md +614 -0
  155. package/skills/global_config/makefile-generator/assets/templates/.gitkeep +1 -0
  156. package/skills/global_config/makefile-generator/docs/makefile-structure.md +530 -0
  157. package/skills/global_config/makefile-generator/docs/optimization-guide.md +784 -0
  158. package/skills/global_config/makefile-generator/docs/patterns-guide.md +642 -0
  159. package/skills/global_config/makefile-generator/docs/security-guide.md +361 -0
  160. package/skills/global_config/makefile-generator/docs/targets-guide.md +642 -0
  161. package/skills/global_config/makefile-generator/docs/variables-guide.md +596 -0
  162. package/skills/global_config/makefile-generator/scripts/add_standard_targets.sh +539 -0
  163. package/skills/global_config/makefile-generator/scripts/generate_makefile_template.sh +690 -0
  164. package/skills/global_config/makefile-generator/test/test_helper_scripts.sh +190 -0
  165. package/skills/global_config/makefile-validator/SKILL.md +244 -0
  166. package/skills/global_config/makefile-validator/docs/bake-tool.md +1000 -0
  167. package/skills/global_config/makefile-validator/docs/best-practices.md +858 -0
  168. package/skills/global_config/makefile-validator/docs/common-mistakes.md +944 -0
  169. package/skills/global_config/makefile-validator/examples/bad-makefile.mk +77 -0
  170. package/skills/global_config/makefile-validator/examples/good-makefile.mk +103 -0
  171. package/skills/global_config/makefile-validator/scripts/test_validate.sh +382 -0
  172. package/skills/global_config/makefile-validator/scripts/validate_makefile.sh +712 -0
  173. package/skills/global_config/{MCP_Manage → mcp-manage}/SKILL.md +3 -3
  174. package/skills/global_config/plan-canvas/SKILL.md +9 -2
  175. package/skills/global_config/plan-canvas/scripts/lib/plan-canvas/ui.js +10 -2
  176. package/skills/global_config/plan-canvas/scripts/plan-canvas.js +1 -1
  177. package/skills/global_config/read-the-damn-docs/SKILL.md +175 -0
  178. package/skills/global_config/requesting-code-review/SKILL.md +98 -0
  179. package/skills/global_config/requesting-code-review/code-reviewer.md +198 -0
  180. package/skills/global_config/using-git-worktrees/SKILL.md +170 -0
  181. package/skills/global_config/verification-before-completion/SKILL.md +123 -0
  182. package/skills/global_config/writing-plans/SKILL.md +126 -46
  183. package/skills/global_config/writing-plans-legacy/SKILL.md +152 -0
  184. package/.claude/CLAUDE.md +0 -12
  185. package/mcps/RhinoMCP/docs/content/docs/getting-started/gemini.md +0 -61
  186. /package/{GEMINI.md → RULES.md} +0 -0
@@ -0,0 +1,404 @@
1
+ # Workflow Orchestration Example
2
+ # Demonstrates: workflow_run trigger, workflow chaining, artifact passing, secure external PR handling
3
+
4
+ # This is the MAIN CI workflow that runs on all PRs
5
+ name: CI Pipeline
6
+
7
+ on:
8
+ push:
9
+ branches: [main, develop]
10
+ pull_request:
11
+ branches: [main]
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ contents: read
16
+ checks: write
17
+
18
+ concurrency:
19
+ group: ci-${{ github.ref }}
20
+ cancel-in-progress: true
21
+
22
+ env:
23
+ NODE_VERSION: '24'
24
+
25
+ jobs:
26
+ # Standard CI jobs - safe for external PRs
27
+ test:
28
+ name: Run Tests
29
+ runs-on: ubuntu-latest
30
+ timeout-minutes: 15
31
+
32
+ steps:
33
+ - name: Checkout code
34
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
35
+
36
+ - name: Setup Node.js
37
+ uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
38
+ with:
39
+ node-version: ${{ env.NODE_VERSION }}
40
+ cache: 'npm'
41
+
42
+ - name: Install dependencies
43
+ run: npm ci
44
+
45
+ - name: Run linter
46
+ run: npm run lint
47
+
48
+ - name: Run tests
49
+ run: npm test -- --coverage
50
+
51
+ - name: Upload coverage
52
+ uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
53
+ with:
54
+ name: coverage-report
55
+ path: coverage/
56
+ retention-days: 7
57
+
58
+ build:
59
+ name: Build Application
60
+ runs-on: ubuntu-latest
61
+ needs: [test]
62
+ timeout-minutes: 15
63
+
64
+ steps:
65
+ - name: Checkout code
66
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
67
+
68
+ - name: Setup Node.js
69
+ uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
70
+ with:
71
+ node-version: ${{ env.NODE_VERSION }}
72
+ cache: 'npm'
73
+
74
+ - name: Install dependencies
75
+ run: npm ci
76
+
77
+ - name: Build application
78
+ env:
79
+ NODE_ENV: production
80
+ run: npm run build
81
+
82
+ - name: Upload build artifacts
83
+ uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
84
+ with:
85
+ name: build-artifacts
86
+ path: dist/
87
+ retention-days: 30
88
+
89
+ ci-status:
90
+ name: CI Status Check
91
+ runs-on: ubuntu-latest
92
+ needs: [test, build]
93
+ if: always()
94
+ timeout-minutes: 5
95
+
96
+ steps:
97
+ - name: Check CI status
98
+ run: |
99
+ if [[ "${{ needs.test.result }}" == "failure" ]] || [[ "${{ needs.build.result }}" == "failure" ]]; then
100
+ echo "❌ CI failed"
101
+ exit 1
102
+ fi
103
+ echo "✅ CI passed"
104
+
105
+ ---
106
+ # SEPARATE WORKFLOW FILE: .github/workflows/security-scan.yml
107
+ # This workflow runs AFTER CI completes, triggered by workflow_run
108
+ # It's safe for external PRs because it runs with the target branch's code
109
+
110
+ name: Security Scan
111
+
112
+ on:
113
+ workflow_run:
114
+ workflows: ["CI Pipeline"]
115
+ types: [completed]
116
+
117
+ # Critical: These permissions are safe because this workflow
118
+ # uses code from the target branch, not the PR
119
+ permissions:
120
+ security-events: write
121
+ contents: read
122
+ actions: read
123
+ issues: write # Required for PR comments via issues.createComment
124
+
125
+ jobs:
126
+ security-scan:
127
+ name: Run Security Scan
128
+ # Only scan if CI passed
129
+ if: ${{ github.event.workflow_run.conclusion == 'success' }}
130
+ runs-on: ubuntu-latest
131
+ timeout-minutes: 20
132
+
133
+ steps:
134
+ # Important: Check out the PR's code explicitly
135
+ # This is safe because we're in workflow_run (target branch context)
136
+ - name: Checkout PR code
137
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
138
+ with:
139
+ ref: ${{ github.event.workflow_run.head_sha }}
140
+
141
+ - name: Setup Node.js
142
+ uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
143
+ with:
144
+ node-version: '24'
145
+ cache: 'npm'
146
+
147
+ - name: Install dependencies
148
+ run: npm ci
149
+
150
+ - name: Run dependency audit
151
+ run: |
152
+ npm audit --audit-level=high || true
153
+ npm audit --json > audit-results.json || true
154
+
155
+ - name: Run CodeQL analysis
156
+ uses: github/codeql-action/init@ae9ef3a1d2e3413523c3741725c30064970cc0d4 # v3.32.5
157
+ with:
158
+ languages: javascript
159
+
160
+ - name: Perform CodeQL analysis
161
+ uses: github/codeql-action/analyze@ae9ef3a1d2e3413523c3741725c30064970cc0d4 # v3.32.5
162
+ with:
163
+ category: security-scan
164
+
165
+ - name: Upload security scan results
166
+ uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
167
+ if: always()
168
+ with:
169
+ name: security-scan-results
170
+ path: |
171
+ audit-results.json
172
+ retention-days: 30
173
+
174
+ - name: Comment on PR with results
175
+ if: github.event.workflow_run.event == 'pull_request'
176
+ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
177
+ with:
178
+ script: |
179
+ const fs = require('fs');
180
+
181
+ // Get PR number from workflow run
182
+ const prNumber = context.payload.workflow_run.pull_requests[0]?.number;
183
+
184
+ if (!prNumber) {
185
+ console.log('Not a PR, skipping comment');
186
+ return;
187
+ }
188
+
189
+ // Read audit results
190
+ let auditResults = {};
191
+ try {
192
+ auditResults = JSON.parse(fs.readFileSync('audit-results.json', 'utf8'));
193
+ } catch (error) {
194
+ console.log('No audit results found');
195
+ }
196
+
197
+ const vulnerabilities = auditResults.metadata?.vulnerabilities || {};
198
+ const total = Object.values(vulnerabilities).reduce((a, b) => a + b, 0);
199
+
200
+ let message = '## 🔒 Security Scan Results\n\n';
201
+
202
+ if (total === 0) {
203
+ message += '✅ No vulnerabilities found!\n';
204
+ } else {
205
+ message += '⚠️ Found vulnerabilities:\n\n';
206
+ message += `- Critical: ${vulnerabilities.critical || 0}\n`;
207
+ message += `- High: ${vulnerabilities.high || 0}\n`;
208
+ message += `- Moderate: ${vulnerabilities.moderate || 0}\n`;
209
+ message += `- Low: ${vulnerabilities.low || 0}\n`;
210
+ }
211
+
212
+ await github.rest.issues.createComment({
213
+ owner: context.repo.owner,
214
+ repo: context.repo.repo,
215
+ issue_number: prNumber,
216
+ body: message
217
+ });
218
+
219
+ ---
220
+ # SEPARATE WORKFLOW FILE: .github/workflows/deploy.yml
221
+ # This workflow deploys to staging/production AFTER CI completes successfully
222
+
223
+ name: Deploy Application
224
+
225
+ on:
226
+ workflow_run:
227
+ workflows: ["CI Pipeline"]
228
+ types: [completed]
229
+ branches: [main, staging]
230
+
231
+ permissions:
232
+ contents: read
233
+ deployments: write
234
+ id-token: write
235
+
236
+ jobs:
237
+ determine-environment:
238
+ name: Determine Deployment Environment
239
+ runs-on: ubuntu-latest
240
+ # Only deploy if CI passed
241
+ if: ${{ github.event.workflow_run.conclusion == 'success' }}
242
+ timeout-minutes: 5
243
+
244
+ outputs:
245
+ environment: ${{ steps.determine.outputs.environment }}
246
+ should-deploy: ${{ steps.determine.outputs.should-deploy }}
247
+
248
+ steps:
249
+ - name: Determine environment
250
+ id: determine
251
+ run: |
252
+ BRANCH="${{ github.event.workflow_run.head_branch }}"
253
+
254
+ case "$BRANCH" in
255
+ main)
256
+ echo "environment=production" >> $GITHUB_OUTPUT
257
+ echo "should-deploy=true" >> $GITHUB_OUTPUT
258
+ ;;
259
+ staging)
260
+ echo "environment=staging" >> $GITHUB_OUTPUT
261
+ echo "should-deploy=true" >> $GITHUB_OUTPUT
262
+ ;;
263
+ *)
264
+ echo "environment=none" >> $GITHUB_OUTPUT
265
+ echo "should-deploy=false" >> $GITHUB_OUTPUT
266
+ ;;
267
+ esac
268
+
269
+ echo "Deploying to: ${{ steps.determine.outputs.environment }}"
270
+
271
+ deploy:
272
+ name: Deploy to ${{ needs.determine-environment.outputs.environment }}
273
+ runs-on: ubuntu-latest
274
+ needs: [determine-environment]
275
+ if: needs.determine-environment.outputs.should-deploy == 'true'
276
+ timeout-minutes: 20
277
+
278
+ environment:
279
+ name: ${{ needs.determine-environment.outputs.environment }}
280
+ url: https://${{ needs.determine-environment.outputs.environment }}.example.com
281
+
282
+ steps:
283
+ # Download artifacts from the CI workflow
284
+ - name: Download build artifacts from CI
285
+ uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
286
+ with:
287
+ name: build-artifacts
288
+ run-id: ${{ github.event.workflow_run.id }}
289
+ github-token: ${{ secrets.GITHUB_TOKEN }}
290
+
291
+ - name: Display downloaded files
292
+ run: |
293
+ echo "Downloaded artifacts:"
294
+ ls -lah
295
+
296
+ - name: Deploy to environment
297
+ env:
298
+ ENVIRONMENT: ${{ needs.determine-environment.outputs.environment }}
299
+ run: |
300
+ echo "Deploying to $ENVIRONMENT"
301
+ echo "Commit SHA: ${{ github.event.workflow_run.head_sha }}"
302
+ echo "Branch: ${{ github.event.workflow_run.head_branch }}"
303
+
304
+ # Deployment commands here
305
+ # Example: Upload to S3, deploy to Kubernetes, etc.
306
+
307
+ - name: Run smoke tests
308
+ env:
309
+ ENVIRONMENT: ${{ needs.determine-environment.outputs.environment }}
310
+ run: |
311
+ URL="https://$ENVIRONMENT.example.com"
312
+ echo "Running smoke tests against $URL"
313
+
314
+ # Basic health check
315
+ curl -f "$URL/health" || exit 1
316
+
317
+ echo "✅ Smoke tests passed"
318
+
319
+ - name: Create deployment summary
320
+ run: |
321
+ cat <<EOF >> $GITHUB_STEP_SUMMARY
322
+ ## 🚀 Deployment Complete
323
+
324
+ **Environment:** ${{ needs.determine-environment.outputs.environment }}
325
+ **Commit:** ${{ github.event.workflow_run.head_sha }}
326
+ **Branch:** ${{ github.event.workflow_run.head_branch }}
327
+ **URL:** https://${{ needs.determine-environment.outputs.environment }}.example.com
328
+
329
+ ### CI Workflow Details
330
+ - **Workflow:** ${{ github.event.workflow_run.name }}
331
+ - **Run ID:** ${{ github.event.workflow_run.id }}
332
+ - **Conclusion:** ${{ github.event.workflow_run.conclusion }}
333
+
334
+ ✅ Deployment successful!
335
+ EOF
336
+
337
+ ---
338
+ # SEPARATE WORKFLOW FILE: .github/workflows/performance-test.yml
339
+ # Run performance tests after CI completes (only on main branch)
340
+
341
+ name: Performance Tests
342
+
343
+ on:
344
+ workflow_run:
345
+ workflows: ["CI Pipeline"]
346
+ types: [completed]
347
+ branches: [main]
348
+
349
+ permissions:
350
+ contents: write # Required for repos.createCommitComment
351
+ actions: read
352
+
353
+ jobs:
354
+ performance-test:
355
+ name: Run Performance Tests
356
+ if: ${{ github.event.workflow_run.conclusion == 'success' }}
357
+ runs-on: ubuntu-latest
358
+ timeout-minutes: 30
359
+
360
+ steps:
361
+ - name: Checkout code
362
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
363
+ with:
364
+ ref: ${{ github.event.workflow_run.head_sha }}
365
+
366
+ - name: Download build artifacts from CI
367
+ uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
368
+ with:
369
+ name: build-artifacts
370
+ run-id: ${{ github.event.workflow_run.id }}
371
+ github-token: ${{ secrets.GITHUB_TOKEN }}
372
+
373
+ - name: Run performance benchmarks
374
+ run: |
375
+ echo "Running performance tests..."
376
+ # Performance test commands here
377
+ # Example: k6, lighthouse, etc.
378
+
379
+ - name: Upload performance results
380
+ uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
381
+ with:
382
+ name: performance-results
383
+ path: performance-results/
384
+ retention-days: 30
385
+
386
+ - name: Comment with performance results
387
+ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
388
+ with:
389
+ script: |
390
+ const message = `## ⚡ Performance Test Results
391
+
392
+ **Commit:** ${{ github.event.workflow_run.head_sha }}
393
+
394
+ ✅ Performance tests completed
395
+
396
+ [View detailed results](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
397
+ `;
398
+
399
+ await github.rest.repos.createCommitComment({
400
+ owner: context.repo.owner,
401
+ repo: context.repo.repo,
402
+ commit_sha: '${{ github.event.workflow_run.head_sha }}',
403
+ body: message
404
+ });
@@ -0,0 +1,68 @@
1
+ # Docker Build and Push Example
2
+ # Demonstrates: Multi-platform builds, Docker layer caching, GitHub Container Registry
3
+
4
+ name: Build and Push Docker Image
5
+
6
+ on:
7
+ push:
8
+ branches: [main]
9
+ tags: ['v*']
10
+ pull_request:
11
+ branches: [main]
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ contents: read
16
+ packages: write
17
+
18
+ env:
19
+ REGISTRY: ghcr.io
20
+ IMAGE_NAME: ${{ github.repository }}
21
+
22
+ jobs:
23
+ build-and-push:
24
+ name: Build and Push Docker Image
25
+ runs-on: ubuntu-latest
26
+ timeout-minutes: 30
27
+
28
+ steps:
29
+ - name: Checkout code
30
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31
+
32
+ - name: Set up Docker Buildx
33
+ uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
34
+
35
+ - name: Log in to GitHub Container Registry
36
+ if: github.event_name != 'pull_request'
37
+ uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
38
+ with:
39
+ registry: ${{ env.REGISTRY }}
40
+ username: ${{ github.actor }}
41
+ password: ${{ secrets.GITHUB_TOKEN }}
42
+
43
+ - name: Extract metadata
44
+ id: meta
45
+ uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
46
+ with:
47
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48
+ tags: |
49
+ type=ref,event=branch
50
+ type=ref,event=pr
51
+ type=semver,pattern={{version}}
52
+ type=semver,pattern={{major}}.{{minor}}
53
+ type=semver,pattern={{major}}
54
+ type=sha,prefix={{branch}}-
55
+
56
+ - name: Build and push Docker image
57
+ uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
58
+ with:
59
+ context: .
60
+ platforms: linux/amd64,linux/arm64
61
+ push: ${{ github.event_name != 'pull_request' }}
62
+ tags: ${{ steps.meta.outputs.tags }}
63
+ labels: ${{ steps.meta.outputs.labels }}
64
+ cache-from: type=gha
65
+ cache-to: type=gha,mode=max
66
+ build-args: |
67
+ VERSION=${{ github.sha }}
68
+ BUILD_DATE=${{ github.event.head_commit.timestamp || github.event.repository.updated_at }}
@@ -0,0 +1,161 @@
1
+ # Go CI Pipeline Example
2
+ # Demonstrates: Matrix testing, caching, linting, testing, code coverage
3
+
4
+ name: Go CI
5
+
6
+ on:
7
+ push:
8
+ branches: [main, develop]
9
+ pull_request:
10
+ branches: [main]
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ concurrency:
17
+ group: ${{ github.workflow }}-${{ github.ref }}
18
+ cancel-in-progress: true
19
+
20
+ env:
21
+ GO_VERSION: '1.22'
22
+
23
+ jobs:
24
+ lint:
25
+ name: Lint Code
26
+ runs-on: ubuntu-latest
27
+ timeout-minutes: 10
28
+
29
+ steps:
30
+ - name: Checkout code
31
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32
+
33
+ - name: Setup Go
34
+ uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
35
+ with:
36
+ go-version: ${{ env.GO_VERSION }}
37
+ cache: true
38
+ cache-dependency-path: go.sum
39
+
40
+ - name: Run golangci-lint
41
+ uses: golangci/golangci-lint-action@e7fa5ac41e1cf5b7d48e45e42232ce7ada589601 # v9.1.0
42
+ with:
43
+ version: v1.55.3
44
+ args: --timeout=5m
45
+
46
+ - name: Run go vet
47
+ run: go vet ./...
48
+
49
+ - name: Run go fmt check
50
+ run: |
51
+ if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
52
+ echo "Code is not formatted. Run 'go fmt ./...'"
53
+ gofmt -s -l .
54
+ exit 1
55
+ fi
56
+
57
+ test:
58
+ name: Test on Go ${{ matrix.go-version }}
59
+ runs-on: ${{ matrix.os }}
60
+ timeout-minutes: 30
61
+
62
+ permissions:
63
+ contents: read
64
+ checks: write
65
+
66
+ strategy:
67
+ matrix:
68
+ os: [ubuntu-latest, windows-latest, macos-latest]
69
+ go-version: ['1.21', '1.22', '1.23']
70
+ exclude:
71
+ - os: macos-latest
72
+ go-version: '1.21'
73
+ fail-fast: false
74
+
75
+ steps:
76
+ - name: Checkout code
77
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
78
+
79
+ - name: Setup Go ${{ matrix.go-version }}
80
+ uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
81
+ with:
82
+ go-version: ${{ matrix.go-version }}
83
+ cache: true
84
+ cache-dependency-path: go.sum
85
+
86
+ - name: Download dependencies
87
+ run: go mod download
88
+
89
+ - name: Verify dependencies
90
+ run: go mod verify
91
+
92
+ - name: Run tests
93
+ run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
94
+
95
+ - name: Generate coverage report
96
+ if: matrix.os == 'ubuntu-latest'
97
+ run: go tool cover -html=coverage.out -o coverage.html
98
+
99
+ - name: Upload test results
100
+ if: always()
101
+ uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
102
+ with:
103
+ name: test-results-${{ matrix.os }}-go${{ matrix.go-version }}
104
+ path: |
105
+ coverage.out
106
+ coverage.html
107
+ retention-days: 7
108
+
109
+ - name: Upload coverage to Codecov
110
+ if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.22'
111
+ uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1
112
+ with:
113
+ token: ${{ secrets.CODECOV_TOKEN }}
114
+ files: ./coverage.out
115
+ fail_ci_if_error: true
116
+
117
+ build:
118
+ name: Build Application
119
+ needs: [lint, test]
120
+ runs-on: ubuntu-latest
121
+ timeout-minutes: 15
122
+
123
+ strategy:
124
+ matrix:
125
+ goos: [linux, darwin, windows]
126
+ goarch: [amd64, arm64]
127
+ exclude:
128
+ - goos: windows
129
+ goarch: arm64
130
+
131
+ steps:
132
+ - name: Checkout code
133
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
134
+
135
+ - name: Setup Go
136
+ uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
137
+ with:
138
+ go-version: ${{ env.GO_VERSION }}
139
+ cache: true
140
+ cache-dependency-path: go.sum
141
+
142
+ - name: Build binary
143
+ env:
144
+ GOOS: ${{ matrix.goos }}
145
+ GOARCH: ${{ matrix.goarch }}
146
+ CGO_ENABLED: 0
147
+ run: |
148
+ OUTPUT_NAME="app-${{ matrix.goos }}-${{ matrix.goarch }}"
149
+ if [ "${{ matrix.goos }}" = "windows" ]; then
150
+ OUTPUT_NAME="${OUTPUT_NAME}.exe"
151
+ fi
152
+ go build -ldflags="-s -w" -o "${OUTPUT_NAME}" .
153
+ ls -lh "${OUTPUT_NAME}"
154
+
155
+ - name: Upload build artifacts
156
+ uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
157
+ with:
158
+ name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
159
+ path: app-*
160
+ retention-days: 7
161
+ if-no-files-found: error