@decocms/start 3.0.0 → 4.1.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.
@@ -1,159 +0,0 @@
1
- // Caller workflow stubs for new sites (v3, D6.2 architecture). Each stub mints
2
- // a short-lived `decocms-deployer` GitHub App installation token and uses it
3
- // to call the corresponding reusable workflow under
4
- // `decocms/deco-start/.github/workflows/`. The customer repo holds no deploy
5
- // logic of its own AND no Cloudflare credentials -- only the App ID + private
6
- // key as deco-sites org-level secrets (`DECOCMS_DEPLOYER_APP_ID` and
7
- // `DECOCMS_DEPLOYER_APP_PRIVATE_KEY`).
8
- //
9
- // See `deploy/README.md` and the migration-tooling-policy rule (D6.2) for the
10
- // full trust model.
11
-
12
- const DEPLOY_YML = `name: Deploy
13
-
14
- # Triggers decocms/deco-start's central deploy workflow via App-token.
15
-
16
- on:
17
- push:
18
- branches: [main]
19
-
20
- permissions:
21
- contents: read
22
-
23
- jobs:
24
- trigger:
25
- runs-on: ubuntu-latest
26
- steps:
27
- - uses: actions/create-github-app-token@v1
28
- id: app-token
29
- with:
30
- app-id: \${{ secrets.DECOCMS_DEPLOYER_APP_ID }}
31
- private-key: \${{ secrets.DECOCMS_DEPLOYER_APP_PRIVATE_KEY }}
32
- owner: decocms
33
- repositories: deco-start
34
- - env:
35
- GH_TOKEN: \${{ steps.app-token.outputs.token }}
36
- run: |
37
- gh workflow run deploy.yml \\
38
- --repo decocms/deco-start \\
39
- --ref v3 \\
40
- -f site_owner=\${GITHUB_REPOSITORY%%/*} \\
41
- -f site_name=\${GITHUB_REPOSITORY##*/}
42
- `;
43
-
44
- const PREVIEW_YML = `name: Preview
45
-
46
- # Triggers decocms/deco-start's central preview workflow via App-token.
47
-
48
- on:
49
- pull_request:
50
- types: [opened, synchronize, reopened]
51
- push:
52
- branches: ['env/**']
53
-
54
- permissions:
55
- contents: read
56
-
57
- jobs:
58
- trigger:
59
- runs-on: ubuntu-latest
60
- steps:
61
- - id: meta
62
- run: |
63
- if [ "\${{ github.event_name }}" = "pull_request" ]; then
64
- echo "alias=pr-\${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
65
- echo "sha=\${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT"
66
- else
67
- REF="\${GITHUB_REF#refs/heads/env/}"
68
- echo "alias=$(echo "$REF" | sed 's|[^a-z0-9-]|-|g')" >> "$GITHUB_OUTPUT"
69
- echo "sha=\${{ github.sha }}" >> "$GITHUB_OUTPUT"
70
- fi
71
- - uses: actions/create-github-app-token@v1
72
- id: app-token
73
- with:
74
- app-id: \${{ secrets.DECOCMS_DEPLOYER_APP_ID }}
75
- private-key: \${{ secrets.DECOCMS_DEPLOYER_APP_PRIVATE_KEY }}
76
- owner: decocms
77
- repositories: deco-start
78
- - env:
79
- GH_TOKEN: \${{ steps.app-token.outputs.token }}
80
- run: |
81
- gh workflow run preview.yml \\
82
- --repo decocms/deco-start \\
83
- --ref v3 \\
84
- -f site_owner=\${GITHUB_REPOSITORY%%/*} \\
85
- -f site_name=\${GITHUB_REPOSITORY##*/} \\
86
- -f site_sha=\${{ steps.meta.outputs.sha }} \\
87
- -f alias=\${{ steps.meta.outputs.alias }} \\
88
- -f pr_number=\${{ github.event.pull_request.number || '' }}
89
- `;
90
-
91
- const REGEN_BLOCKS_YML = `name: Regenerate blocks.gen.json
92
-
93
- # Thin caller for decocms/deco-start's central regen-blocks workflow.
94
- # This one stays as workflow_call: it runs in the caller's runner context
95
- # (writes back to the storefront repo) and needs no Cloudflare credentials.
96
-
97
- on:
98
- push:
99
- branches: [main]
100
- paths:
101
- - ".deco/blocks/**"
102
-
103
- permissions:
104
- contents: write
105
-
106
- jobs:
107
- regen:
108
- uses: decocms/deco-start/.github/workflows/regen-blocks.yml@v3
109
- secrets: inherit
110
- `;
111
-
112
- const SYNC_SECRETS_YML = `name: Sync worker secrets
113
-
114
- # Triggers decocms/deco-start's central sync-secrets workflow via App-token.
115
- # The actual SECRET_* values live in deco-start's '\${repo-basename}-secrets'
116
- # environment, NOT in this repo. See deco-start's deploy/README.md.
117
-
118
- on:
119
- workflow_dispatch:
120
- inputs:
121
- mode:
122
- description: "dry-run = print diff only | apply = set secrets on worker"
123
- required: true
124
- default: "dry-run"
125
- type: choice
126
- options: [dry-run, apply]
127
-
128
- permissions:
129
- contents: read
130
-
131
- jobs:
132
- trigger:
133
- runs-on: ubuntu-latest
134
- steps:
135
- - uses: actions/create-github-app-token@v1
136
- id: app-token
137
- with:
138
- app-id: \${{ secrets.DECOCMS_DEPLOYER_APP_ID }}
139
- private-key: \${{ secrets.DECOCMS_DEPLOYER_APP_PRIVATE_KEY }}
140
- owner: decocms
141
- repositories: deco-start
142
- - env:
143
- GH_TOKEN: \${{ steps.app-token.outputs.token }}
144
- run: |
145
- gh workflow run sync-secrets.yml \\
146
- --repo decocms/deco-start \\
147
- --ref v3 \\
148
- -f site_name=\${GITHUB_REPOSITORY##*/} \\
149
- -f mode=\${{ inputs.mode }}
150
- `;
151
-
152
- export function generateGithubWorkflows(): Record<string, string> {
153
- return {
154
- ".github/workflows/deploy.yml": DEPLOY_YML,
155
- ".github/workflows/preview.yml": PREVIEW_YML,
156
- ".github/workflows/regen-blocks.yml": REGEN_BLOCKS_YML,
157
- ".github/workflows/sync-secrets.yml": SYNC_SECRETS_YML,
158
- };
159
- }