pipecraft 0.0.0-releaseit → 0.26.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 (183) hide show
  1. package/README.md +126 -108
  2. package/dist/cli/index.d.ts +69 -0
  3. package/dist/cli/index.d.ts.map +1 -1
  4. package/dist/cli/index.js +94 -22
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/generators/init.tpl.d.ts +70 -0
  7. package/dist/generators/init.tpl.d.ts.map +1 -1
  8. package/dist/generators/init.tpl.js +100 -8
  9. package/dist/generators/init.tpl.js.map +1 -1
  10. package/dist/generators/workflows.tpl.d.ts +86 -0
  11. package/dist/generators/workflows.tpl.d.ts.map +1 -1
  12. package/dist/generators/workflows.tpl.js +101 -9
  13. package/dist/generators/workflows.tpl.js.map +1 -1
  14. package/dist/templates/actions/calculate-version.yml.tpl.d.ts +47 -0
  15. package/dist/templates/actions/calculate-version.yml.tpl.d.ts.map +1 -1
  16. package/dist/templates/actions/calculate-version.yml.tpl.js +72 -3
  17. package/dist/templates/actions/calculate-version.yml.tpl.js.map +1 -1
  18. package/dist/templates/actions/create-pr.yml.tpl.d.ts +14 -0
  19. package/dist/templates/actions/create-pr.yml.tpl.d.ts.map +1 -1
  20. package/dist/templates/actions/create-pr.yml.tpl.js +22 -2
  21. package/dist/templates/actions/create-pr.yml.tpl.js.map +1 -1
  22. package/dist/templates/actions/create-release.yml.tpl.d.ts +18 -0
  23. package/dist/templates/actions/create-release.yml.tpl.d.ts.map +1 -0
  24. package/dist/templates/actions/create-release.yml.tpl.js +141 -0
  25. package/dist/templates/actions/create-release.yml.tpl.js.map +1 -0
  26. package/dist/templates/actions/create-tag.yml.tpl.d.ts +14 -0
  27. package/dist/templates/actions/create-tag.yml.tpl.d.ts.map +1 -1
  28. package/dist/templates/actions/create-tag.yml.tpl.js +22 -2
  29. package/dist/templates/actions/create-tag.yml.tpl.js.map +1 -1
  30. package/dist/templates/actions/detect-changes.yml.tpl.d.ts +70 -0
  31. package/dist/templates/actions/detect-changes.yml.tpl.d.ts.map +1 -1
  32. package/dist/templates/actions/detect-changes.yml.tpl.js +98 -2
  33. package/dist/templates/actions/detect-changes.yml.tpl.js.map +1 -1
  34. package/dist/templates/actions/manage-branch.yml.tpl.d.ts +14 -0
  35. package/dist/templates/actions/manage-branch.yml.tpl.d.ts.map +1 -1
  36. package/dist/templates/actions/manage-branch.yml.tpl.js +22 -2
  37. package/dist/templates/actions/manage-branch.yml.tpl.js.map +1 -1
  38. package/dist/templates/actions/promote-branch.yml.tpl.d.ts +14 -0
  39. package/dist/templates/actions/promote-branch.yml.tpl.d.ts.map +1 -1
  40. package/dist/templates/actions/promote-branch.yml.tpl.js +50 -7
  41. package/dist/templates/actions/promote-branch.yml.tpl.js.map +1 -1
  42. package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts +114 -1
  43. package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts.map +1 -1
  44. package/dist/templates/workflows/pipeline-path-based.yml.tpl.js +479 -74
  45. package/dist/templates/workflows/pipeline-path-based.yml.tpl.js.map +1 -1
  46. package/dist/types/index.d.ts +231 -8
  47. package/dist/types/index.d.ts.map +1 -1
  48. package/dist/types/index.js +9 -0
  49. package/dist/types/index.js.map +1 -1
  50. package/dist/utils/ast-path-operations.d.ts.map +1 -1
  51. package/dist/utils/ast-path-operations.js +24 -11
  52. package/dist/utils/ast-path-operations.js.map +1 -1
  53. package/dist/utils/config.d.ts +63 -0
  54. package/dist/utils/config.d.ts.map +1 -1
  55. package/dist/utils/config.js +71 -0
  56. package/dist/utils/config.js.map +1 -1
  57. package/dist/utils/github-setup.d.ts +323 -2
  58. package/dist/utils/github-setup.d.ts.map +1 -1
  59. package/dist/utils/github-setup.js +551 -23
  60. package/dist/utils/github-setup.js.map +1 -1
  61. package/dist/utils/idempotency.d.ts +147 -7
  62. package/dist/utils/idempotency.d.ts.map +1 -1
  63. package/dist/utils/idempotency.js +143 -15
  64. package/dist/utils/idempotency.js.map +1 -1
  65. package/dist/utils/logger.d.ts +134 -0
  66. package/dist/utils/logger.d.ts.map +1 -0
  67. package/dist/utils/logger.js +153 -0
  68. package/dist/utils/logger.js.map +1 -0
  69. package/dist/utils/preflight.d.ts +223 -12
  70. package/dist/utils/preflight.d.ts.map +1 -1
  71. package/dist/utils/preflight.js +216 -16
  72. package/dist/utils/preflight.js.map +1 -1
  73. package/dist/utils/versioning.d.ts +160 -8
  74. package/dist/utils/versioning.d.ts.map +1 -1
  75. package/dist/utils/versioning.js +179 -15
  76. package/dist/utils/versioning.js.map +1 -1
  77. package/package.json +26 -5
  78. package/.claude/settings.local.json +0 -35
  79. package/.github/actions/calculate-version/action.yml +0 -106
  80. package/.github/actions/create-pr/action.yml +0 -122
  81. package/.github/actions/create-release/action.yml +0 -74
  82. package/.github/actions/create-tag/action.yml +0 -94
  83. package/.github/actions/detect-changes/action.yml +0 -62
  84. package/.github/actions/manage-branch/action.yml +0 -113
  85. package/.github/actions/promote-branch/action.yml +0 -352
  86. package/.github/example/workflows/job.analyze.code.yml +0 -26
  87. package/.github/example/workflows/job.analyze.docker.yml +0 -32
  88. package/.github/example/workflows/job.app.api.deploy.yml +0 -127
  89. package/.github/example/workflows/job.app.api.test.yml +0 -102
  90. package/.github/example/workflows/job.app.docs.deploy.yml +0 -40
  91. package/.github/example/workflows/job.app.docs.test.yml +0 -50
  92. package/.github/example/workflows/job.app.web.deploy.yml +0 -96
  93. package/.github/example/workflows/job.app.web.test.yml +0 -49
  94. package/.github/example/workflows/job.changes.yml +0 -82
  95. package/.github/example/workflows/job.create-pr.yml +0 -96
  96. package/.github/example/workflows/job.env-check.yml +0 -43
  97. package/.github/example/workflows/job.fast-forward.yml +0 -103
  98. package/.github/example/workflows/job.lint.yml +0 -64
  99. package/.github/example/workflows/job.pr-name.yml +0 -70
  100. package/.github/example/workflows/job.pr-squash-name.yml +0 -27
  101. package/.github/example/workflows/job.tag.yml +0 -38
  102. package/.github/example/workflows/job.version.yml +0 -99
  103. package/.github/example/workflows/lib.plugin-base.publish.yml +0 -59
  104. package/.github/example/workflows/pipe.yml +0 -178
  105. package/.github/example/workflows/scripts/fastforward.sh +0 -51
  106. package/.github/example/workflows/scripts/pipe-cleaner.sh +0 -70
  107. package/.github/scripts/fastforward.sh +0 -51
  108. package/.github/scripts/pipe-cleaner.sh +0 -70
  109. package/.github/workflows/pipeline.yml +0 -220
  110. package/.github/workflows/pr-title-check.yml +0 -70
  111. package/.github/workflows/publish.yml +0 -39
  112. package/.pipecraftrc.json +0 -78
  113. package/.release-it.cjs +0 -71
  114. package/PIPELINE_TESTING_PLAN.md +0 -499
  115. package/TRUNK_FLOW_PLAN.md +0 -401
  116. package/assets/logo_banner.png +0 -0
  117. package/assets/logo_banner.webp +0 -0
  118. package/docs/USER_JOURNEY_ERRORS.md +0 -352
  119. package/eslint.config.js +0 -77
  120. package/examples/basic-config.json +0 -41
  121. package/examples/monorepo-config.json +0 -49
  122. package/examples/usage.md +0 -289
  123. package/scripts/debug-workflows.sh +0 -339
  124. package/scripts/parse-pipeline.js +0 -29
  125. package/scripts/test-job-order.cjs +0 -140
  126. package/scripts/validate-pipeline.cjs +0 -379
  127. package/scripts/verify-job-order.sh +0 -30
  128. package/src/cli/index.ts +0 -414
  129. package/src/generators/init.tpl.ts +0 -126
  130. package/src/generators/workflows.tpl.ts +0 -80
  131. package/src/templates/actions/calculate-version.yml.tpl.ts +0 -124
  132. package/src/templates/actions/create-pr.yml.tpl.ts +0 -147
  133. package/src/templates/actions/create-tag.yml.tpl.ts +0 -112
  134. package/src/templates/actions/detect-changes.yml.tpl.ts +0 -87
  135. package/src/templates/actions/manage-branch.yml.tpl.ts +0 -132
  136. package/src/templates/actions/promote-branch.yml.tpl.ts +0 -364
  137. package/src/templates/workflows/pipeline-path-based.yml.tpl.ts +0 -706
  138. package/src/types/index.ts +0 -64
  139. package/src/utils/README-ast-path-operations.md +0 -390
  140. package/src/utils/ast-path-operations.ts +0 -581
  141. package/src/utils/config.ts +0 -64
  142. package/src/utils/github-setup.ts +0 -558
  143. package/src/utils/idempotency.ts +0 -215
  144. package/src/utils/preflight.ts +0 -306
  145. package/src/utils/versioning.ts +0 -244
  146. package/tests/README.md +0 -229
  147. package/tests/TEST_STRUCTURE.md +0 -256
  148. package/tests/act/run-act-tests.sh +0 -345
  149. package/tests/debugging/debug-utils.ts +0 -538
  150. package/tests/debugging/debug-workflow.test.ts +0 -339
  151. package/tests/debugging/debug-workflows.sh +0 -339
  152. package/tests/debugging/iterative-debug.ts +0 -652
  153. package/tests/debugging/run-debug-tests.sh +0 -431
  154. package/tests/fixtures/basic-config.json +0 -51
  155. package/tests/fixtures/invalid-config.json +0 -9
  156. package/tests/fixtures/pipeline-generated.yml +0 -235
  157. package/tests/fixtures/pipeline-preserve-comments.yml +0 -245
  158. package/tests/fixtures/pipeline-user-modified.yml +0 -245
  159. package/tests/fixtures/test-config.json +0 -58
  160. package/tests/github-live/README.md +0 -250
  161. package/tests/github-local/JOB_WORKFLOW_TESTS.md +0 -296
  162. package/tests/github-local/README.md +0 -240
  163. package/tests/github-local/run-all-tests.sh +0 -422
  164. package/tests/github-local/test-job-workflows.sh +0 -631
  165. package/tests/github-local/test-pipeline-workflow.sh +0 -440
  166. package/tests/integration/generators.test.ts +0 -578
  167. package/tests/integration/path-based-template.test.ts +0 -510
  168. package/tests/integration/simple-path-based.test.ts +0 -415
  169. package/tests/setup.ts +0 -56
  170. package/tests/unit/ast-path-operations-extended.test.ts +0 -302
  171. package/tests/unit/cli.test.ts +0 -541
  172. package/tests/unit/config-extended.test.ts +0 -412
  173. package/tests/unit/config.test.ts +0 -152
  174. package/tests/unit/github-setup.test.ts +0 -189
  175. package/tests/unit/idempotency-isolated.test.ts +0 -297
  176. package/tests/unit/job-order.test.ts +0 -157
  177. package/tests/unit/pipeline-path-based.test.ts +0 -511
  178. package/tests/unit/validate-pipeline.test.ts +0 -384
  179. package/tests/unit/versioning-extended.test.ts +0 -279
  180. package/tests/unit/versioning.test.ts +0 -241
  181. package/tsconfig.debug.json +0 -17
  182. package/tsconfig.json +0 -28
  183. package/vitest.config.ts +0 -51
@@ -1,26 +0,0 @@
1
- name: CodeQL Analysis
2
-
3
- on:
4
- workflow_call:
5
- workflow_dispatch:
6
-
7
- jobs:
8
- analyze:
9
- runs-on: ubuntu-latest
10
- permissions:
11
- actions: read
12
- contents: read
13
- security-events: write
14
- strategy:
15
- fail-fast: false
16
- matrix:
17
- language: [javascript, typescript]
18
- steps:
19
- - name: Checkout repository
20
- uses: actions/checkout@v4
21
- # - name: Initialize CodeQL
22
- # uses: github/codeql-action/init@v3
23
- # with:
24
- # languages: ${{ matrix.language }}
25
- # - name: Perform CodeQL Analysis
26
- # uses: github/codeql-action/analyze@v3
@@ -1,32 +0,0 @@
1
- name: Trivy Security Scan
2
-
3
- on:
4
- workflow_call:
5
- workflow_dispatch:
6
-
7
- jobs:
8
- analyze:
9
- runs-on: ubuntu-latest
10
- container: aquasec/trivy:latest # 🔹 Use Trivy's Docker image directly
11
- steps:
12
- - name: Checkout Code
13
- uses: actions/checkout@v4
14
-
15
- # ✅ Scan all directories containing a Dockerfile for misconfigurations
16
- - name: Scan Dockerfile Misconfigurations
17
- run: |
18
- echo "Scanning directories containing Dockerfiles..."
19
- for dir in $(find . -name "Dockerfile" -exec dirname {} \; | sort -u); do
20
- echo "Scanning $dir..."
21
- trivy config --severity HIGH,CRITICAL --exit-code 1 "$dir"
22
- done
23
-
24
- # ✅ Scan images listed in Docker Compose files
25
- - name: Scan Docker Compose Images
26
- run: |
27
- echo "Extracting images from docker-compose.yml files..."
28
- images=$(grep -hPo '(?<=image: )\S+' **/docker-compose.yml | sort -u || true)
29
- for image in $images; do
30
- echo "Scanning $image..."
31
- trivy image --exit-code 1 --severity HIGH,CRITICAL "$image"
32
- done
@@ -1,127 +0,0 @@
1
- name: "API:Job:Deploy"
2
-
3
- on:
4
- workflow_call:
5
- inputs:
6
- version:
7
- description: 'The version to deploy'
8
- required: true
9
- type: string
10
- project_id:
11
- description: 'The project ID for the environment'
12
- required: true
13
- type: string
14
-
15
- jobs:
16
- deploy:
17
- environment: ${{ github.ref_name == 'main' && 'production' || github.ref_name }}
18
- env:
19
- ENV: ${{ github.ref_name == 'main' && 'production' || github.ref_name }}
20
- API_DIR: "apps/api"
21
- PROJECT_ID: ${{ inputs.project_id }}
22
- REGION: "us-east4"
23
-
24
- runs-on: ubuntu-latest
25
- steps:
26
- - name: Checkout
27
- uses: actions/checkout@v4
28
- with:
29
- fetch-tags: true
30
-
31
- - name: Debug Environment Variables
32
- run: |
33
- echo "PROJECT_ID from env: $PROJECT_ID"
34
- echo "Input project_id: ${{ inputs.project_id }}"
35
- echo "All environment variables:"
36
- env | sort
37
-
38
-
39
- - name: Get SHA for "migration" tag
40
- id: get-migration-sha
41
- run: |
42
- if git rev-parse refs/tags/migration >/dev/null 2>&1; then
43
- echo "MIGRATION_SHA=$(git rev-parse refs/tags/_migration-${{ env.ENV }})"
44
- echo "MIGRATION_SHA=$(git rev-parse refs/tags/_migration-${{ env.ENV }})" >> $GITHUB_ENV
45
- else
46
- echo "MIGRATION_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
47
- fi
48
-
49
- - name: Get changes in migrations folder
50
- id: changed-files-migrations
51
- uses: tj-actions/changed-files@v42
52
- with:
53
- files: apps/api/migrations/**
54
- sha: ${{ env.MIGRATION_SHA }}
55
-
56
-
57
- - name: Authenticate with Google
58
- uses: 'google-github-actions/auth@v2'
59
- with:
60
- project_id: ${{ env.PROJECT_ID }}
61
- credentials_json: ${{ secrets.GCP_CREDENTIALS }}
62
-
63
- - name: Build and Push Container
64
- uses: whoan/docker-build-with-cache-action@v5
65
- with:
66
- username: _json_key
67
- password: ${{ secrets.GCP_CREDENTIALS }}
68
- registry: ${{ vars.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ vars.AR_REPO }}
69
- image_name: api-${{ env.PROJECT_ID }}
70
- image_tag: ${{ github.sha }}
71
- context: .
72
- dockerfile: ${{ env.API_DIR }}/Dockerfile
73
-
74
- # - name: Deploy to Cloud Run with Migration
75
- # id: migration
76
- # if: steps.changed-files-migrations.outputs.any_changed == 'true' || github.event.inputs.migration_input == true
77
- # uses: google-github-actions/deploy-cloudrun@v2.0.0
78
- # with:
79
- # project_id: ${{ env.PROJECT_ID }}
80
- # service: api-${{ env.PROJECT_ID }}
81
- # region: ${{ env.REGION }}
82
- # image: ${{ vars.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ vars.AR_REPO }}/api-${{ env.PROJECT_ID }}:${{ github.sha }}
83
- # env_vars: |
84
- # MIGRATION=${{ toJson(github.event.inputs.migration_input) || steps.changed-files-migrations.outputs.any_changed }}
85
- # NODE_CONFIG_ENV=${{ env.ENV }}
86
- # SEED=false
87
- # no_traffic: true
88
-
89
- # - name: Create Migration tag
90
- # if: steps.migration.outcome == 'success'
91
- # uses: actions/github-script@v7
92
- # with:
93
- # script: require('./libs/cicd/upsertTag.cjs')({ github, context, tag:"_migration-${{ env.ENV }}" })
94
-
95
- # - name: Seed Data to Instance
96
- # id: seed
97
- # if: steps.changed-files-migrations.outputs.any_changed == 'true' || github.event.inputs.migration_input == true
98
- # uses: google-github-actions/deploy-cloudrun@v2.0.0
99
- # with:
100
- # project_id: ${{ env.PROJECT_ID }}
101
- # service: api-${{ env.PROJECT_ID }}
102
- # region: ${{ env.REGION }}
103
- # image: ${{ vars.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ vars.AR_REPO }}/api-${{ env.PROJECT_ID }}:${{ github.sha }}
104
- # env_vars: |
105
- # MIGRATION=false
106
- # SEED=${{ github.ref_name == 'main' && 'false' || toJson(github.event.inputs.migration_input) || 'true' }}
107
- # NODE_CONFIG_ENV=${{ env.ENV }}
108
- # no_traffic: true
109
-
110
- - name: Deploy to Cloud Run
111
- uses: google-github-actions/deploy-cloudrun@v2.6.1
112
- with:
113
- project_id: ${{ env.PROJECT_ID }}
114
- service: api-${{ env.PROJECT_ID }}
115
- region: ${{ env.REGION }}
116
- image: ${{ vars.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ vars.AR_REPO }}/api-${{ env.PROJECT_ID }}:${{ github.sha }}
117
- env_vars: |
118
- MIGRATION=false
119
- SEED=false
120
- NODE_CONFIG_ENV=${{ env.ENV }}
121
-
122
-
123
- # - name: Create Deployed Tag
124
- # uses: actions/github-script@v7
125
- # with:
126
- # script: require('./libs/cicd/upsertTag.cjs')({ github, context, tag:"_deployed-${{ env.ENV }}" })
127
-
@@ -1,102 +0,0 @@
1
- on:
2
- workflow_call:
3
- workflow_dispatch:
4
-
5
- env:
6
- API_DIR: apps/api
7
- DOCKER_REGISTRY: https://ghcr.io # the github registry
8
- COMPOSE_FILE: apps/api/test/contracts/contract.docker-compose.yml
9
-
10
- jobs:
11
- blueprint:
12
- env:
13
- CONTRACT_TYPE: "blueprint"
14
- runs-on: ubuntu-latest
15
- timeout-minutes: 7
16
- steps:
17
- - name: Checkout
18
- uses: actions/checkout@v4
19
- with:
20
- fetch-tags: true
21
-
22
- - name: Login to GitHub Container Registry
23
- uses: docker/login-action@v3
24
- with:
25
- registry: ${{ env.DOCKER_REGISTRY }}
26
- username: ${{ github.repository_owner }}
27
- password: ${{ secrets.GITHUB_TOKEN }}
28
-
29
- - name: Start stack
30
- shell: bash
31
- run: |
32
- echo OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} > ${{ env.API_DIR }}/.env
33
- echo CONTRACT_TYPE=${{ env.CONTRACT_TYPE }} >> ${{ env.API_DIR }}/.env
34
- docker compose --env-file ${{ env.API_DIR }}/.env -f ${{ env.COMPOSE_FILE }} up --exit-code-from newman
35
-
36
- - name: Stop stacks
37
- if: always()
38
- shell: bash
39
- run: |
40
- docker compose -f ${{ env.COMPOSE_FILE }} down
41
-
42
- plugin-loader:
43
- env:
44
- CONTRACT_TYPE: "plugin-loader"
45
- runs-on: ubuntu-latest
46
- timeout-minutes: 7
47
- steps:
48
- - name: Checkout
49
- uses: actions/checkout@v4
50
- with:
51
- fetch-tags: true
52
-
53
- - name: Login to GitHub Container Registry
54
- uses: docker/login-action@v3
55
- with:
56
- registry: ${{ env.DOCKER_REGISTRY }}
57
- username: ${{ github.repository_owner }}
58
- password: ${{ secrets.GITHUB_TOKEN }}
59
-
60
- - name: Start stack
61
- shell: bash
62
- run: |
63
- echo OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} > ${{ env.API_DIR }}/.env
64
- echo CONTRACT_TYPE=${{ env.CONTRACT_TYPE }} >> ${{ env.API_DIR }}/.env
65
- docker compose --env-file ${{ env.API_DIR }}/.env -f ${{ env.COMPOSE_FILE }} up --exit-code-from newman
66
-
67
- - name: Stop stacks
68
- if: always()
69
- shell: bash
70
- run: |
71
- docker compose -f ${{ env.COMPOSE_FILE }} down
72
-
73
- raw-parser:
74
- env:
75
- CONTRACT_TYPE: "raw-parser"
76
- runs-on: ubuntu-latest
77
- timeout-minutes: 7
78
- steps:
79
- - name: Checkout
80
- uses: actions/checkout@v4
81
- with:
82
- fetch-tags: true
83
-
84
- - name: Login to GitHub Container Registry
85
- uses: docker/login-action@v3
86
- with:
87
- registry: ${{ env.DOCKER_REGISTRY }}
88
- username: ${{ github.repository_owner }}
89
- password: ${{ secrets.GITHUB_TOKEN }}
90
-
91
- - name: Start stack
92
- shell: bash
93
- run: |
94
- echo CONTRACT_TYPE=${{ env.CONTRACT_TYPE }} > ${{ env.API_DIR }}/.env
95
- docker compose --env-file ${{ env.API_DIR }}/.env -f ${{ env.COMPOSE_FILE }} up parser newman --exit-code-from newman
96
-
97
- - name: Stop stacks
98
- if: always()
99
- shell: bash
100
- run: |
101
- docker compose -f ${{ env.COMPOSE_FILE }} down
102
-
@@ -1,40 +0,0 @@
1
- name: "Docs:Deploy"
2
-
3
-
4
- on:
5
- workflow_dispatch:
6
- push:
7
- branches:
8
- - main
9
- paths:
10
- - apps/docs/**/*
11
- # Review gh actions docs if you want to further define triggers, paths, etc
12
- # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
13
- workflow_call:
14
- inputs:
15
- version:
16
- description: 'The version to deploy'
17
- required: true
18
- type: string
19
-
20
- jobs:
21
- deploy:
22
- # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
23
- permissions:
24
- pages: write # to deploy to Pages
25
- id-token: write # to verify the deployment originates from an appropriate source
26
- if: github.ref == 'refs/heads/main'
27
- name: Deploy to GitHub Pages
28
- runs-on: ubuntu-latest
29
- steps:
30
- - name: Checkout code
31
- uses: actions/checkout@v4
32
-
33
- - name: Download Build Artifact
34
- uses: actions/download-artifact@v3
35
- with:
36
- name: docs-build
37
-
38
- - name: Deploy to GitHub Pages
39
- id: deployment
40
- uses: actions/deploy-pages@v4
@@ -1,50 +0,0 @@
1
- name: "Docs:Deploy"
2
-
3
-
4
- on:
5
- workflow_dispatch:
6
- workflow_call:
7
-
8
- jobs:
9
- build:
10
- name: Build Docusaurus
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v4
14
- with:
15
- fetch-depth: 0
16
-
17
- - name: Setup node
18
- uses: actions/setup-node@v4
19
- with:
20
- node-version: 20
21
- cache-dependency-path: 'pnpm-lock.yaml'
22
-
23
- - name: Install pnpm
24
- run: npm install -g pnpm
25
-
26
- - name: Get pnpm store directory
27
- shell: bash
28
- run: |
29
- echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
30
-
31
- - uses: actions/cache@v4
32
- name: Setup pnpm cache
33
- with:
34
- path: ${{ env.STORE_PATH }}
35
- key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
36
- restore-keys: |
37
- ${{ runner.os }}-pnpm-store-
38
-
39
- - name: Install dependencies
40
- run: pnpm install --frozen-lockfile --filter @madi/docs
41
-
42
- - name: Build website
43
- working-directory: ./apps/docs
44
- run: pnpm run build
45
-
46
- - name: Upload Build Artifact
47
- uses: actions/upload-artifact@v4
48
- with:
49
- name: docs-build
50
- path: ./apps/docs/build
@@ -1,96 +0,0 @@
1
- name: Build and Deploy to Google Cloud Storage
2
- on:
3
- workflow_call:
4
- inputs:
5
- project_id:
6
- description: 'The project ID for the environment'
7
- required: true
8
- type: string
9
- bucket:
10
- description: 'The bucket to store the deployment'
11
- required: true
12
- type: string
13
-
14
- jobs:
15
- build_and_push_image:
16
- environment: ${{ github.ref_name == 'main' && 'production' || github.ref_name }}
17
- permissions:
18
- contents: 'read'
19
- id-token: 'write'
20
- runs-on: ubuntu-latest
21
- env:
22
- WORKING_DIR: ./apps/interfaces/web
23
- WEB_STORAGE: ${{ inputs.bucket }}
24
- steps:
25
- - name: Checkout
26
- uses: actions/checkout@v4
27
-
28
- - name: Authenticate with Google
29
- uses: 'google-github-actions/auth@v2'
30
- with:
31
- project_id: ${{ inputs.project_id }}
32
- credentials_json: ${{ secrets.GCP_CREDENTIALS }}
33
-
34
- - name: Setup node
35
- uses: actions/setup-node@v4
36
- with:
37
- node-version: 20
38
-
39
- - name: Install pnpm
40
- run: npm install -g pnpm
41
- working-directory: ${{ env.WORKING_DIR }}
42
-
43
- - name: Cache pnpm store
44
- uses: actions/cache@v4
45
- with:
46
- path: ~/.pnpm-store
47
- key: ${{ runner.os }}-pnpm-store-${{ hashFiles('${{ env.WORKING_DIR }}/pnpm-lock.yaml') }}
48
- restore-keys: |
49
- ${{ runner.os }}-pnpm-store-${{ env.WORKING_DIR }}-
50
-
51
- - name: Install dependencies
52
- run: pnpm install --frozen-lockfile -F @madi/web
53
-
54
- - name: Cache Next.js
55
- uses: actions/cache@v4
56
- with:
57
- path: |
58
- ~/.pnpm-store
59
- ${{ github.workspace }}/${{ env.WORKING_DIR }}/.next/cache
60
- key: ${{ runner.os }}-nextjs-${{ env.WORKING_DIR }}-${{ hashFiles('${{ env.WORKING_DIR }}/pnpm-lock.yaml') }}-${{ hashFiles('${{ env.WORKING_DIR }}/**/*.js', '${{ env.WORKING_DIR }}/**/*.jsx', '${{ env.WORKING_DIR }}/**/*.ts', '${{ env.WORKING_DIR }}/**/*.tsx') }}
61
- restore-keys: |
62
- ${{ runner.os }}-nextjs-${{ env.WORKING_DIR }}-${{ hashFiles('${{ env.WORKING_DIR }}/pnpm-lock.yaml') }}-
63
-
64
- - name: Build the distribution
65
- run: pnpm -F @madi/web run build;
66
-
67
- - name: Store release SHA in JSON file
68
- working-directory: ${{ env.WORKING_DIR }}
69
- run: |
70
- mkdir -p ${{ env.WORKING_DIR }}/dist
71
- REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2)
72
- echo '{
73
- "sha": "${{ github.sha }}",
74
- "owner": "${{ github.repository_owner }}",
75
- "repo": "'$REPO_NAME'",
76
- "branch": "${{ github.ref_name }}"
77
- }' > ${{ env.WORKING_DIR }}/dist/sha.json
78
-
79
- - name: Download Built Documentation
80
- uses: actions/download-artifact@v4
81
- with:
82
- name: docs-build
83
- path: ${{ env.WORKING_DIR }}/dist/docs
84
-
85
- - name: 'Set up Cloud SDK'
86
- uses: 'google-github-actions/setup-gcloud@v2'
87
- with:
88
- version: 'latest'
89
- project_id: ${{ inputs.project_id }}
90
-
91
- - name: 'Sync dist to bucket (delete the old files)'
92
- run: |
93
- gsutil -m -h "Cache-Control:public, max-age=0" rsync -d -r "${{ env.WORKING_DIR }}/dist" "gs://${{ env.WEB_STORAGE }}"
94
-
95
- ## TODO: Set max-age back up to 3600 when stack stabilizes.
96
- # gs://web-app-hq-madi-dev-4ebd7d92-7d0cb30c/
@@ -1,49 +0,0 @@
1
- name: "Web: Lint & Test"
2
-
3
- on:
4
- workflow_call:
5
- workflow_dispatch:
6
-
7
- jobs:
8
- smoke-tests:
9
- timeout-minutes: 60
10
- runs-on: ubuntu-latest
11
- steps:
12
- - name: Checkout repository
13
- uses: actions/checkout@v4
14
-
15
- - name: Setup node
16
- uses: actions/setup-node@v4
17
- with:
18
- node-version: 20
19
-
20
- - name: Install pnpm
21
- run: npm install -g pnpm
22
-
23
- - name: Cache dependencies
24
- uses: actions/cache@v4
25
- with:
26
- path: ~/.pnpm-store
27
- key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
28
- restore-keys: |
29
- ${{ runner.os }}-pnpm-
30
-
31
- - name: Install dependencies
32
- run: pnpm install -F @madi/web
33
-
34
- - name: Cache Playwright browsers
35
- id: cache-playwright-browsers
36
- uses: actions/cache@v4
37
- with:
38
- path: ~/.cache/ms-playwright
39
- key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
40
- restore-keys: |
41
- ${{ runner.os }}-playwright-
42
-
43
- - name: Install Playwright Browsers
44
- run: pnpm exec playwright install --with-deps
45
- working-directory: apps/interfaces/web
46
-
47
- - name: Run Playwright tests
48
- run: pnpm exec playwright test
49
- working-directory: apps/interfaces/web
@@ -1,82 +0,0 @@
1
- name: "Changes"
2
-
3
- on:
4
- workflow_call:
5
- outputs:
6
- api:
7
- value: ${{ jobs.changes.outputs.api }}
8
- web:
9
- value: ${{ jobs.changes.outputs.web }}
10
- docs:
11
- value: ${{ jobs.changes.outputs.docs }}
12
- libs:
13
- value: ${{ jobs.changes.outputs.libs }}
14
- cicd:
15
- value: ${{ jobs.changes.outputs.cicd }}
16
-
17
- workflow_dispatch:
18
-
19
- jobs:
20
- changes:
21
- runs-on: ubuntu-latest
22
- permissions:
23
- contents: read
24
- pull-requests: read
25
- outputs:
26
- api: ${{ steps.merge.outputs.api }}
27
- web: ${{ steps.merge.outputs.web }}
28
- docs: ${{ steps.merge.outputs.docs }}
29
- libs: ${{ steps.merge.outputs.libs }}
30
- cicd: ${{ steps.merge.outputs.cicd }}
31
- steps:
32
-
33
- - uses: actions/checkout@v4
34
- with:
35
- fetch-depth: 0
36
-
37
- - name: Set Base Branch
38
- id: set-base
39
- ## if base branch is develop compare to test. Test and Main always fully deploy
40
- run: |
41
- base_branch=$(
42
- if [[ '${{ github.ref }}' == 'refs/heads/develop' ]]; then
43
- echo 'test'
44
- else
45
- echo 'develop'
46
- fi
47
- )
48
- echo "Base branch determined: $base_branch"
49
- echo "base_branch=$base_branch" >> $GITHUB_ENV
50
-
51
- - uses: dorny/paths-filter@v3
52
- id: filter
53
- with:
54
- base: ${{ env.base_branch }}
55
- filters: |
56
- api:
57
- - 'apps/api/**'
58
- web:
59
- - 'apps/interfaces/web/**'
60
- docs:
61
- - 'apps/docs/**'
62
- libs:
63
- - 'libs/**'
64
- cicd:
65
- - '.github/workflows/**'
66
-
67
- - name: Merge filter outputs with branch condition
68
- id: merge
69
- run: |
70
- echo "api=${{ steps.filter.outputs.api == 'true' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/test' }}" >> $GITHUB_OUTPUT
71
- echo "web=${{ steps.filter.outputs.web == 'true' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/test' }}" >> $GITHUB_OUTPUT
72
- echo "docs=${{ steps.filter.outputs.docs == 'true' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/test' }}" >> $GITHUB_OUTPUT
73
- echo "libs=${{ steps.filter.outputs.libs == 'true' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/test' }}" >> $GITHUB_OUTPUT
74
- echo "cicd=${{ steps.filter.outputs.cicd == 'true' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/test' }}" >> $GITHUB_OUTPUT
75
-
76
- - name: Debug Paths Filter Outputs
77
- run: |
78
- echo "API: ${{ steps.merge.outputs.api }}"
79
- echo "WEB: ${{ steps.merge.outputs.web }}"
80
- echo "DOCS: ${{ steps.merge.outputs.docs }}"
81
- echo "LIBS: ${{ steps.merge.outputs.libs }}"
82
- echo "CICD: ${{ steps.merge.outputs.cicd }}"