-
Notifications
You must be signed in to change notification settings - Fork 2
/
buildspec.yml
51 lines (51 loc) · 1.85 KB
/
buildspec.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# spec:
# https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html
version: 0.2
env:
variables:
TZ: "America/New_York date"
# The remote origin that will be used if building through CodePipeline
remote_origin: "[email protected]:bastionzero/zli.git"
version_check_branch: master
parameter-store:
GITHUB_KEY_PATH: "/github/sshkey/path"
SSH_KEY_PATH: "/webshell/sshkey/path"
phases:
install:
runtime-versions:
nodejs: 14
commands:
- echo Install started on `date`
# We need to 1.16 and this isnt in yum
- wget https://dl.google.com/go/go1.16.4.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.16.4.linux-amd64.tar.gz
- echo 'export PATH=/usr/local/go/bin:$PATH' >>~/.bash_profile
- export PATH=/usr/local/go/bin:$PATH
- npm ci
- npm i -g semver
pre_build:
commands:
- echo Pre-Build phase...
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- aws s3 cp $(dirname $GITHUB_KEY_PATH) ~/.ssh --recursive --include ".pem"
- aws s3 cp $(dirname $SSH_KEY_PATH) ~/.ssh --recursive --include ".pem"
- chmod 600 ~/.ssh/*
- ls -als ~/.ssh/*
- eval `ssh-agent -s`
- ssh-add ~/.ssh/*.pem
- git submodule update --init --recursive --depth 50
build:
commands:
- echo Build started on `date`
- echo "Running eslint linter"
- npm run lint
- echo "Building zli"
- npm run release-prod
- echo "Checking VERSION is incremented compared to target branch ${version_check_branch}"
- TARGET_VERSION=$(git show "${version_check_branch}:package.json" | jq -r .version)
- BRANCH_VERSION=$(cat package.json| jq -r .version)
- echo Master Version=$TARGET_VERSION, Branch Version=$BRANCH_VERSION
- semver "$BRANCH_VERSION" -r ">$TARGET_VERSION"
- echo "Running zli Unit Tests"
- npm run test