@adobe/helix-deploy 10.2.1 → 10.3.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [10.3.0](https://github.com/adobe/helix-deploy/compare/v10.2.1...v10.3.0) (2024-01-22)
2
+
3
+
4
+ ### Features
5
+
6
+ * support environment variable interpolation in config using syntax ${env.VAR_NAME} ([#649](https://github.com/adobe/helix-deploy/issues/649)) ([ae52a1b](https://github.com/adobe/helix-deploy/commit/ae52a1b308a4bf0f986246f25c4937216bfa82f2)), closes [#644](https://github.com/adobe/helix-deploy/issues/644)
7
+
1
8
  ## [10.2.1](https://github.com/adobe/helix-deploy/compare/v10.2.0...v10.2.1) (2024-01-20)
2
9
 
3
10
 
package/README.md CHANGED
@@ -4,9 +4,8 @@
4
4
  ## Status
5
5
  [![GitHub license](https://img.shields.io/github/license/adobe/helix-deploy.svg)](https://github.com/adobe/helix-deploy/blob/main/LICENSE.txt)
6
6
  [![GitHub issues](https://img.shields.io/github/issues/adobe/helix-deploy.svg)](https://github.com/adobe/helix-deploy/issues)
7
- [![CircleCI](https://img.shields.io/circleci/project/github/adobe/helix-deploy.svg)](https://circleci.com/gh/adobe/helix-deploy)
7
+ ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/adobe/helix-deploy/main.yaml)
8
8
  [![codecov](https://img.shields.io/codecov/c/github/adobe/helix-deploy.svg)](https://codecov.io/gh/adobe/helix-deploy)
9
- [![LGTM Code Quality Grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/adobe/helix-deploy.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/adobe/helix-deploy)
10
9
 
11
10
  ## Setup
12
11
 
@@ -287,6 +286,23 @@ In order to automatically use the version of the `package.json` use:
287
286
  > **Note**: the version is internally taken from the `pkgVersion` variable, so it can be overridden with
288
287
  the `--pkgVersion` argument, in case it should be deployed differently.
289
288
 
289
+ ### Environment Variable Interpolation in Arguments
290
+
291
+ In addition to the `${version}` token described above, arguments will be interpolated using environment variables where the variables exist. For example, given an environment variable named `PROBOT_DOCKER_VERSION` is set to `latest`, this configuration:
292
+
293
+ ```json
294
+ {
295
+ ...
296
+ "wsk": {
297
+ ...
298
+ "docker": "adobe/probot-ow-nodejs8:${env.PROBOT_DOCKER_VERSION}"
299
+ },
300
+ ...
301
+ }
302
+ ```
303
+
304
+ Will result in the materialized value of the `docker` argument to be set to `adobe/probot-ow-nodejs8:latest`.
305
+
290
306
  #### Automatically create semantic versioning sequence actions
291
307
 
292
308
  By using the `--version-link` (`-l`), the bulider can create action sequences _linking_ to the deployed version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-deploy",
3
- "version": "10.2.1",
3
+ "version": "10.3.0",
4
4
  "description": "Library and Commandline Tools to build and deploy OpenWhisk Actions",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/adobe/helix-deploy#readme",
@@ -25,6 +25,7 @@
25
25
  "test": "c8 mocha -i -g Integration",
26
26
  "integration-ci": "c8 mocha -g Integration",
27
27
  "semantic-release": "semantic-release",
28
+ "semantic-release-dry": "semantic-release --dry-run --branches $CI_BRANCH",
28
29
  "prepare": "husky install"
29
30
  },
30
31
  "mocha": {
package/src/cli.js CHANGED
@@ -38,7 +38,28 @@ export default class CLI {
38
38
  constructor() {
39
39
  this._yargs = yargs()
40
40
  .pkgConf('wsk')
41
- .env('HLX');
41
+ .env('HLX')
42
+ .middleware((argv) => {
43
+ // convert process.env to flattened object with flat keys
44
+ // since ActionBuilder.substitute() expects this format.
45
+ const envVars = Object.entries(process.env)
46
+ .reduce((env, [key, value]) => {
47
+ // eslint-disable-next-line no-param-reassign
48
+ env[`env.${key}`] = value;
49
+ return env;
50
+ }, {});
51
+
52
+ const substitute = (value) => (typeof value === 'string' ? ActionBuilder.substitute(value, envVars) : value);
53
+ Object.entries(argv).forEach(([key, value]) => {
54
+ if (typeof value === 'string') {
55
+ // eslint-disable-next-line no-param-reassign
56
+ argv[key] = substitute(value, envVars);
57
+ } else if (Array.isArray(value)) {
58
+ // eslint-disable-next-line no-param-reassign
59
+ argv[key] = value.map((v) => substitute(v, envVars));
60
+ }
61
+ });
62
+ });
42
63
  BaseConfig.yarg(this._yargs);
43
64
  PLUGINS.forEach((PluginClass) => PluginClass.Config.yarg(this._yargs));
44
65
  this._yargs