jsii-release 0.2.180 → 0.2.181
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/README.md +1 -0
- package/bin/jsii-release-npm +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,6 +64,7 @@ npx jsii-release-npm [DIR]
|
|
|
64
64
|
|`NPM_DIST_TAG`|Optional|Registers the published package with the given [dist-tag](https://docs.npmjs.com/cli/dist-tag) (e.g. `next`, default is `latest`)|
|
|
65
65
|
|`AWS_ACCESS_KEY_ID`|Optional|If AWS CodeArtifact is used as registry, an AWS access key can be spedified.|
|
|
66
66
|
|`AWS_SECRET_ACCESS_KEY`|Optional|Secret access key that belongs to the AWS access key.|
|
|
67
|
+
|`AWS_ROLE_TO_ASSUME`|Optional|If AWS CodeArtifact is used as registry, an AWS role ARN to assume before authorizing.|
|
|
67
68
|
|
|
68
69
|
## Maven
|
|
69
70
|
|
package/bin/jsii-release-npm
CHANGED
|
@@ -13,6 +13,7 @@ set -eu
|
|
|
13
13
|
# NPM_REGISTRY (optional): the registry URL (defaults to "registry.npmjs.org")
|
|
14
14
|
# AWS_ACCESS_KEY_ID (optional): If AWS CodeArtifact is used as registry, an AWS access key can be spedified.
|
|
15
15
|
# AWS_SECRET_ACCESS_KEY (optional): Secret access key that belongs to the AWS access key.
|
|
16
|
+
# AWS_ROLE_TO_ASSUME (optional): If AWS CodeArtifact is used as registry and need to assume role.
|
|
16
17
|
#
|
|
17
18
|
###
|
|
18
19
|
|
|
@@ -24,6 +25,12 @@ if ! [ -z "${NPM_REGISTRY:-}" ] && [[ $NPM_REGISTRY =~ .codeartifact.*.amazonaws
|
|
|
24
25
|
codeartifact_subdomain="$(echo $NPM_REGISTRY | cut -d. -f1)"
|
|
25
26
|
codeartifact_domain="$(echo $codeartifact_subdomain | cut -b -$((${#codeartifact_subdomain}-${#codeartifact_account}-1)))"
|
|
26
27
|
codeartifact_region="$(echo $NPM_REGISTRY | cut -d. -f4)"
|
|
28
|
+
if [ -n "${AWS_ROLE_TO_ASSUME:-}" ]; then
|
|
29
|
+
credentials=`aws sts assume-role --role-session-name "jsii-release-code-artifact" --role-arn ${AWS_ROLE_TO_ASSUME} --output text | sed -n '2 p'`
|
|
30
|
+
AWS_ACCESS_KEY_ID="$(echo $credentials | cut -d' ' -f2)"
|
|
31
|
+
AWS_SECRET_ACCESS_KEY="$(echo $credentials | cut -d' ' -f4)"
|
|
32
|
+
AWS_SESSION_TOKEN="$(echo $credentials | cut -d' ' -f5)"
|
|
33
|
+
fi
|
|
27
34
|
NPM_TOKEN=`aws codeartifact get-authorization-token --domain $codeartifact_domain --domain-owner $codeartifact_account --region $codeartifact_region --query authorizationToken --output text`
|
|
28
35
|
elif [ -z "${NPM_TOKEN:-}" ]; then
|
|
29
36
|
echo "NPM_TOKEN is required"
|