You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(ci-cd): document staging mTLS deployments via GitHub Actions (#431)
* docs(ci-cd): document staging mTLS deployments via GitHub Actions
Add a Staging Environments section to the CI/CD guide covering the
two-factor mTLS pattern (separate webdav hostname + .p12 client cert)
in both CLI flag and GitHub Actions form. Extend the setup action with
webdav-server, certificate, certificate-passphrase, and selfsigned
inputs so workflows can target staging without bespoke env wiring.
Cross-link with the existing mTLS section in the configuration guide.
* fix: tighten selfsigned env handling and correct setup re-run note
- setup action: only export SFCC_SELFSIGNED when input is "true"/"1".
oclif boolean env-mapped flags treat any non-empty value as true,
while the SDK env-var source only parses "true"/"1" — exporting
arbitrary values produced inconsistent behavior. Now omitting the
input (or passing "false") cleanly leaves the flag at its default.
- ci-cd.md: correct misleading tip claiming a second setup overwrites
env vars; in fact it only overrides env vars for inputs that are
actually re-passed (others persist from the prior setup).
* docs(ci-cd): use real SFCC_* env var names in staging example
The staging mTLS section invented SFCC_STAGING_* secret/variable names that
looked like tooling env vars but are not read by anything. Rename them to the
actual SFCC_* names the tooling consumes (matching the Authentication section
convention) and keep only the base64 cert blob under a plainly non-SFCC name,
making clear it is decoded to a file rather than read as an env var.
Document deploying to staging environments (two-factor mTLS) from CI/CD. The `setup` GitHub Action now accepts `webdav-server`, `certificate`, `certificate-passphrase`, and `selfsigned` inputs so workflows can target staging instances that require a separate WebDAV hostname and a client certificate. The CI/CD guide includes a full GitHub Actions example using a base64-encoded `.p12` secret.
| `selfsigned` | `SFCC_SELFSIGNED` | Allow self-signed server certs |
107
+
108
+
For staging environments that require a separate WebDAV hostname and a client certificate, see the [Staging Environments guide](https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/ci-cd.html#staging-environments-two-factor-mtls) for the full pattern (decoding a base64-encoded `.p12` from a secret + wiring it through `setup`).
Copy file name to clipboardExpand all lines: docs/guide/ci-cd.md
+138Lines changed: 138 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,6 +129,30 @@ Installs the CLI and writes credentials to environment variables. Use this when
129
129
130
130
Plugins are installed after the CLI; already-installed plugins are skipped by exact name match. Each line is an npm package name or GitHub `owner/repo`. For reliable skip-on-reinstall, prefer the published npm package name — when a GitHub `owner/repo` slug differs from the package it publishes, the plugin is reinstalled each run (harmless, just slower).
131
131
132
+
The setup action accepts the following inputs (each maps to the corresponding `SFCC_*` environment variable):
The `webdav-server`, `certificate`, `certificate-passphrase`, and `selfsigned` inputs are only needed for staging environments that require a separate WebDAV hostname and a client certificate (mTLS). See [Staging Environments (Two-Factor mTLS)](#staging-environments-two-factor-mtls).
Staging mTLS works with the standard actions — the `setup` action accepts `webdav-server`, `certificate`, `certificate-passphrase`, and `selfsigned` inputs alongside the usual auth inputs.
344
+
345
+
Because the `.p12` is a binary file, store it as a base64-encoded GitHub secret and decode it to disk in a workflow step before calling `setup`. The `certificate` input then points at the decoded path.
346
+
347
+
These are in addition to the [authentication](#authentication) secrets and variables — the same `SFCC_*` names used elsewhere map straight through to the `setup` inputs:
348
+
349
+
| Secret | Maps to input → env var | Description |
|`SFCC_SERVER`|`server` → `SFCC_SERVER`| e.g. `staging-internal-ccdemo.demandware.net`|
359
+
|`SFCC_WEBDAV_SERVER`|`webdav-server` → `SFCC_WEBDAV_SERVER`| e.g. `cert.staging.internal.ccdemo.demandware.net`|
360
+
361
+
`STAGING_CERTIFICATE_P12_BASE64` is the only value here that is **not** an `SFCC_*` environment variable — it holds the raw base64 of the certificate file, which a workflow step decodes to disk. The `certificate` input then points at that decoded path (the tooling reads the file path from `SFCC_CERTIFICATE`, not the certificate contents).
362
+
363
+
To create the base64 secret locally:
364
+
365
+
```bash
366
+
base64 -i deploy.p12 | pbcopy # macOS
367
+
# or
368
+
base64 -w0 deploy.p12 # Linux
369
+
```
370
+
371
+
Then paste the value into a GitHub repository secret.
372
+
373
+
**Workflow example:**
374
+
375
+
```yaml
376
+
name: Deploy to Staging
377
+
378
+
on:
379
+
workflow_dispatch:
380
+
381
+
jobs:
382
+
deploy:
383
+
runs-on: ubuntu-latest
384
+
steps:
385
+
- uses: actions/checkout@v4
386
+
387
+
# Decode the .p12 to a file inside the runner workspace
Once the `setup` step writes `SFCC_CERTIFICATE`, `SFCC_WEBDAV_SERVER`, etc. to `$GITHUB_ENV`, every subsequent action picks them up automatically — no need to repeat them on `code-deploy`, `data-import`, `job-run`, or `webdav-upload`.
413
+
414
+
::: tip Multiple Environments in One Workflow
415
+
If a single workflow targets both a normal sandbox and a staging instance, run `setup` again before each phase with the appropriate inputs. The second `setup` only overrides env vars for inputs you actually pass — anything left blank keeps its value from the previous `setup`. To fully switch environments, re-pass every variable that should change (or use the `env:` block on individual steps to scope overrides).
416
+
:::
417
+
418
+
::: warning Cleanup
419
+
The decoded `.p12` lives only inside the runner's ephemeral workspace and is destroyed when the job ends. Never commit the file or write it outside `$RUNNER_TEMP` / the workspace.
Copy file name to clipboardExpand all lines: docs/guide/configuration.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -290,6 +290,12 @@ For instances that require client certificate authentication:
290
290
291
291
The certificate must be in PKCS12 format (`.p12` or `.pfx`). The `self-signed` option is often needed for staging environments with internal certificates.
292
292
293
+
The same fields are available as CLI flags (`--webdav-server`, `--certificate`, `--passphrase`, `--selfsigned`) and as environment variables (`SFCC_WEBDAV_SERVER`, `SFCC_CERTIFICATE`, `SFCC_CERTIFICATE_PASSPHRASE`, `SFCC_SELFSIGNED`).
294
+
295
+
::: tip Running staging deploys in CI/CD
296
+
For GitHub Actions workflows that target staging — including how to handle the `.p12` certificate as a base64-encoded secret — see [Staging Environments (Two-Factor mTLS)](/guide/ci-cd#staging-environments-two-factor-mtls).
297
+
:::
298
+
293
299
::: tip MRT Configuration
294
300
MRT API key can also be loaded from `~/.mobify`. See [MRT API Key](#mrt-api-key) below.
0 commit comments