@geekmidas/cli 10.0.0-alpha.113 → 10.0.0-alpha.114

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.
package/dist/index.cjs CHANGED
@@ -57,7 +57,7 @@ crypto = require_rolldown_runtime.__toESM(crypto, 1);
57
57
  let _geekmidas_constructs_functions = require("@geekmidas/constructs/functions");
58
58
  let _geekmidas_constructs_topic = require("@geekmidas/constructs/topic");
59
59
  //#region package.json
60
- var version = "10.0.0-alpha.113";
60
+ var version = "10.0.0-alpha.114";
61
61
  //#endregion
62
62
  //#region src/prompt.ts
63
63
  /**
@@ -5949,25 +5949,25 @@ function loadPackageJson() {
5949
5949
  * Run: pnpm --filter @geekmidas/cli sync-versions
5950
5950
  */
5951
5951
  const GEEKMIDAS_VERSIONS = {
5952
- "@geekmidas/audit": "~10.0.0-alpha.113",
5953
- "@geekmidas/auth": "~10.0.0-alpha.113",
5954
- "@geekmidas/cache": "~10.0.0-alpha.113",
5955
- "@geekmidas/client": "~10.0.0-alpha.113",
5956
- "@geekmidas/cloud": "~10.0.0-alpha.113",
5957
- "@geekmidas/constructs": "~10.0.0-alpha.113",
5958
- "@geekmidas/db": "~10.0.0-alpha.113",
5959
- "@geekmidas/emailkit": "~10.0.0-alpha.113",
5960
- "@geekmidas/envkit": "~10.0.0-alpha.113",
5961
- "@geekmidas/errors": "~10.0.0-alpha.113",
5962
- "@geekmidas/events": "~10.0.0-alpha.113",
5963
- "@geekmidas/logger": "~10.0.0-alpha.113",
5964
- "@geekmidas/manifest": "~10.0.0-alpha.113",
5965
- "@geekmidas/rate-limit": "~10.0.0-alpha.113",
5966
- "@geekmidas/schema": "~10.0.0-alpha.113",
5967
- "@geekmidas/services": "~10.0.0-alpha.113",
5968
- "@geekmidas/storage": "~10.0.0-alpha.113",
5969
- "@geekmidas/telescope": "~10.0.0-alpha.113",
5970
- "@geekmidas/testkit": "~10.0.0-alpha.113",
5952
+ "@geekmidas/audit": "~10.0.0-alpha.114",
5953
+ "@geekmidas/auth": "~10.0.0-alpha.114",
5954
+ "@geekmidas/cache": "~10.0.0-alpha.114",
5955
+ "@geekmidas/client": "~10.0.0-alpha.114",
5956
+ "@geekmidas/cloud": "~10.0.0-alpha.114",
5957
+ "@geekmidas/constructs": "~10.0.0-alpha.114",
5958
+ "@geekmidas/db": "~10.0.0-alpha.114",
5959
+ "@geekmidas/emailkit": "~10.0.0-alpha.114",
5960
+ "@geekmidas/envkit": "~10.0.0-alpha.114",
5961
+ "@geekmidas/errors": "~10.0.0-alpha.114",
5962
+ "@geekmidas/events": "~10.0.0-alpha.114",
5963
+ "@geekmidas/logger": "~10.0.0-alpha.114",
5964
+ "@geekmidas/manifest": "~10.0.0-alpha.114",
5965
+ "@geekmidas/rate-limit": "~10.0.0-alpha.114",
5966
+ "@geekmidas/schema": "~10.0.0-alpha.114",
5967
+ "@geekmidas/services": "~10.0.0-alpha.114",
5968
+ "@geekmidas/storage": "~10.0.0-alpha.114",
5969
+ "@geekmidas/telescope": "~10.0.0-alpha.114",
5970
+ "@geekmidas/testkit": "~10.0.0-alpha.114",
5971
5971
  "@geekmidas/cli": `~${loadPackageJson().version}`
5972
5972
  };
5973
5973
  //#endregion
@@ -7160,7 +7160,7 @@ const COMMIT = /^[0-9a-f]{40}$/;
7160
7160
  * The `uses:` value for the stages action, with a comment saying which CLI
7161
7161
  * release the pinned commit is.
7162
7162
  */
7163
- function stagesActionUses(commit = "18d6b7860652d3db231d361933ee2d5ec10f0941", version = cliVersion()) {
7163
+ function stagesActionUses(commit = "82e87263a7c554204b12819f4eff2c4f7e9c8a96", version = cliVersion()) {
7164
7164
  return commit && COMMIT.test(commit) ? `${STAGES_ACTION}@${commit} # @geekmidas/cli ${version}` : `${STAGES_ACTION}@main # pin to a commit SHA: see the action's README`;
7165
7165
  }
7166
7166
  //#endregion
@@ -7412,6 +7412,7 @@ function stagesJob(options) {
7412
7412
  has-build: \${{ steps.stages.outputs.has-build }}
7413
7413
  has-deploy: \${{ steps.stages.outputs.has-deploy }}
7414
7414
  aws-region: \${{ steps.stages.outputs.aws-region }}
7415
+ registry: \${{ steps.stages.outputs.registry }}
7415
7416
  steps:
7416
7417
  - uses: actions/checkout@v4
7417
7418
 
@@ -7430,17 +7431,25 @@ ${pm.setup}
7430
7431
  `;
7431
7432
  }
7432
7433
  /**
7433
- * The registry login a compose build pushes with: GitHub's own token on
7434
- * ghcr.io, otherwise a username variable and a password secret.
7434
+ * The registry login a compose build pushes with, and a deploy pulls with.
7435
+ * The host is `deploy.registry`'s, read from gkm.config.ts by the stages
7436
+ * job at run time — never written here, so the workflow follows the config:
7437
+ * GitHub's own token on ghcr.io, otherwise the stage environment's
7438
+ * `REGISTRY_USERNAME` variable and `REGISTRY_PASSWORD` secret.
7435
7439
  */
7436
- function registryLogin(registry) {
7437
- const host = registry.split("/")[0];
7438
- const ghcr = host === "ghcr.io";
7439
- return ` - uses: docker/login-action@v3
7440
+ function registryLogin() {
7441
+ const ghcr = "needs.stages.outputs.registry == 'ghcr.io'";
7442
+ return ` # deploy.registry in gkm.config.ts: GitHub's registry with this
7443
+ # workflow's own token (the job's \`packages\` permission decides push
7444
+ # or pull), any other with the stage's REGISTRY_USERNAME variable and
7445
+ # REGISTRY_PASSWORD secret.
7446
+ - name: Log in to the registry
7447
+ if: needs.stages.outputs.registry != ''
7448
+ uses: docker/login-action@v3
7440
7449
  with:
7441
- registry: ${host}
7442
- username: ${ghcr ? "${{ github.actor }}" : "${{ vars.REGISTRY_USERNAME }}"}
7443
- password: ${ghcr ? "${{ secrets.GITHUB_TOKEN }}" : "${{ secrets.REGISTRY_PASSWORD }}"}
7450
+ registry: \${{ needs.stages.outputs.registry }}
7451
+ username: \${{ ${ghcr} && github.actor || vars.REGISTRY_USERNAME }}
7452
+ password: \${{ ${ghcr} && secrets.GITHUB_TOKEN || secrets.REGISTRY_PASSWORD }}
7444
7453
  `;
7445
7454
  }
7446
7455
  /**
@@ -7459,8 +7468,14 @@ function registryLogin(registry) {
7459
7468
  */
7460
7469
  function composeDeploy(options) {
7461
7470
  const pm = tooling(options);
7462
- const registry = options.registry ?? "";
7463
7471
  return `${deployHeader(true)}
7472
+ # A push to main builds main's newest commit: a later push cancels an earlier
7473
+ # push's run, so several merges in a row build once. A release or a manual
7474
+ # run shares no group (its run id is in the name), and is never cancelled.
7475
+ concurrency:
7476
+ group: \${{ github.workflow }}-\${{ github.event_name == 'push' && github.ref || github.run_id }}
7477
+ cancel-in-progress: \${{ github.event_name == 'push' }}
7478
+
7464
7479
  jobs:
7465
7480
  ${stagesJob(options)}
7466
7481
  build:
@@ -7479,13 +7494,22 @@ ${stagesJob(options)}
7479
7494
  packages: write
7480
7495
  id-token: write
7481
7496
  steps:
7497
+ # The runner's preinstalled toolchains, none of them used here: with
7498
+ # them, building every image of a workspace runs out of disk.
7499
+ - name: Free disk space
7500
+ run: |
7501
+ sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc \\
7502
+ /usr/local/.ghcup /opt/hostedtoolcache/CodeQL
7503
+ sudo docker image prune --all --force
7504
+ df -h /
7505
+
7482
7506
  - uses: actions/checkout@v4
7483
7507
 
7484
7508
  ${pm.setup}
7485
7509
  - name: Install
7486
7510
  run: ${pm.install}
7487
7511
 
7488
- ${registryLogin(registry)}
7512
+ ${registryLogin()}
7489
7513
  # A site's public URLs are built into it, so the build reads the stage's
7490
7514
  # secrets store. With secrets.store on S3, SSM or Secrets Manager the job
7491
7515
  # assumes the stage's role (AWS_ROLE_ARN, set by gkm deploy:github);
@@ -7511,6 +7535,7 @@ ${registryLogin(registry)}
7511
7535
  with:
7512
7536
  name: digests-\${{ matrix.stage }}
7513
7537
  path: digests.json
7538
+ if-no-files-found: error
7514
7539
  retention-days: 90
7515
7540
 
7516
7541
  deploy:
@@ -7544,8 +7569,14 @@ ${registryLogin(registry)}
7544
7569
  workflow_dispatch) ref="\${REF:-$SHA}" ;;
7545
7570
  *) ref="$SHA" ;;
7546
7571
  esac
7547
- sha=$(gh api "repos/$REPO/commits/$ref" --jq .sha)
7548
- echo "Deploying $sha"
7572
+ case "$ref" in
7573
+ ''|-*) echo "::error::Not a tag or commit: '$ref'"; exit 1 ;;
7574
+ esac
7575
+ if ! sha=$(gh api "repos/$REPO/commits/$ref" --jq .sha); then
7576
+ echo "::error::'$ref' is not a tag, branch or commit in this repository"
7577
+ exit 1
7578
+ fi
7579
+ echo "Deploying $ref = $sha"
7549
7580
  echo "sha=$sha" >> "$GITHUB_OUTPUT"
7550
7581
  env:
7551
7582
  GH_TOKEN: \${{ github.token }}
@@ -7566,7 +7597,7 @@ ${pm.setup}
7566
7597
 
7567
7598
  # The server's engine pulls with the login docker sends from here: it
7568
7599
  # holds none of its own.
7569
- ${registryLogin(registry)}
7600
+ ${registryLogin()}
7570
7601
  # The stage's secrets and deploy state are read and written here, with
7571
7602
  # the stage's role (AWS_ROLE_ARN, set by gkm deploy:github). With the
7572
7603
  # default 'file' secrets store there is no role, and no secrets file in
@@ -13046,6 +13077,7 @@ export default function RootLayout({
13046
13077
  `;
13047
13078
  const pages = app.key === "admin" ? adminPages() : webPages(options);
13048
13079
  const gitignore = `.next/
13080
+ next-env.d.ts
13049
13081
  node_modules/
13050
13082
  .env.local
13051
13083
  *.log
@@ -16760,7 +16792,7 @@ program.command("stages").description("The workspace's stages from gkm.config.ts
16760
16792
  try {
16761
16793
  const globalOptions = program.opts();
16762
16794
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
16763
- const { stagesCommand } = await Promise.resolve().then(() => require("./stages-_3RVNG83.cjs"));
16795
+ const { stagesCommand } = await Promise.resolve().then(() => require("./stages-D4SnG5yl.cjs"));
16764
16796
  await stagesCommand(options);
16765
16797
  } catch (error) {
16766
16798
  exitWithError(error);