UNPKG

835 Bapplication/x-shView Raw
1#!/bin/bash
2set -euo pipefail
3
4commit=${CODEBUILD_RESOLVED_SOURCE_VERSION:-}
5# CODEBUILD_RESOLVED_SOURCE_VERSION is not defined (i.e. local build or CodePipeline build),
6# use the HEAD commit hash
7if [ -z "${commit}" ]; then
8 commit="$(git rev-parse --verify HEAD)"
9 suffix="@dev"
10fi
11
12VERSION=$(node -p "require('./package.json').version.replace(/\\+[0-9a-f]+\$/, '')")
13
14cat > lib/version.ts <<HERE
15// Generated at $(date -u +"%Y-%m-%dT%H:%M:%SZ") by generate.sh
16
17/** The short version number for this jsii-pacmak release (e.g: \`X.Y.Z\`) */
18// eslint-disable-next-line @typescript-eslint/no-inferrable-types
19export const VERSION: string = '${VERSION}';
20
21/** The qualified version number for this jsii-pacmak release (e.g: \`X.Y.Z (build #######)\`) */
22export const VERSION_DESC = '${VERSION} (build ${commit:0:7}${suffix:-})';
23HERE