-
Notifications
You must be signed in to change notification settings - Fork 2
/
webshell-cli-release.yml
55 lines (55 loc) · 1.88 KB
/
webshell-cli-release.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
52
53
54
55
# spec:
# https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html
version: 0.2
env:
variables:
TZ: "America/New_York date"
ReleaseDir: "release"
parameter-store:
GITHUB_KEY_PATH: "/github/sshkey/path"
SSH_KEY_PATH: "/webshell/sshkey/path"
phases:
install:
runtime-versions:
nodejs: 14
commands:
- echo Install started `date`
- apt-get update -y && apt-get install build-essential cmake -y
- npm ci
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
- echo Installing go 1.16...
# 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
build:
commands:
- echo Build started `date`
- git submodule update --init --recursive --depth 50
- npm run release-prod
post_build:
commands:
- if ! [ -z "${DRY_RUN}" ]; then echo "Dry run exiting early before publishing" && exit 1; fi
- echo Post build started `date`
- Version=$(node -p "require('./package.json').version")
- mkdir -p $ReleaseDir/$Version
- cp -a bin $ReleaseDir/$Version
- cp -a $ReleaseDir/$Version $ReleaseDir/latest
- release-scripts/create-manifest.sh > $ReleaseDir/latest/MANIFEST
- aws cloudfront create-invalidation --distribution-id=E16AJOUNJ6VWEY --paths '/release/latest/*'
artifacts:
files:
- "**/*"
base-directory: $ReleaseDir
name: release