forked from mattermost/notices
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
67 lines (63 loc) · 1.99 KB
/
.gitlab-ci.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
56
57
58
59
60
61
62
63
64
65
66
67
stages:
- verify-json
- deploy
validate-json:
image: node:lts-alpine3.11
stage: verify-json
script:
- npm install -g ajv-cli
- ajv validate -s notices.schema.json -d notices.json | tee ajv-out.txt
only:
refs:
- master
- release
- e2etest
pre-release:
image: amazon/aws-cli
stage: deploy
script:
- pwd
- ls -al
- mkdir tmp
- aws s3 sync s3://$BUCKET/latest/ tmp/
- ls -al tmp
- env
- if ! cmp -s "tmp/notices.json" "notices.json"; then aws s3 cp notices.json s3://$BUCKET/pre-release/notices.json && aws s3api put-object-acl --bucket $BUCKET --key pre-release/notices.json --acl public-read && aws cloudfront create-invalidation --distribution-id $DISTRIBUTION --paths "/pre-release/notices.json"; fi
variables:
BUCKET: notices.mattermost.com
DISTRIBUTION: EHBBKR634JLB1
only:
refs:
- master
release:
image: amazon/aws-cli
stage: deploy
script:
- pwd
- ls -al
- mkdir tmp
- aws s3 sync s3://$BUCKET/latest/ tmp/
- ls -al tmp
- if ! cmp -s "tmp/notices.json" "notices.json"; then aws s3 cp notices.json s3://$BUCKET/latest/notices.json && aws s3api put-object-acl --bucket $BUCKET --key latest/notices.json --acl public-read && aws cloudfront create-invalidation --distribution-id $DISTRIBUTION --paths "/latest/notices.json"; fi
variables:
BUCKET: notices.mattermost.com
DISTRIBUTION: EHBBKR634JLB1
only:
refs:
- release
e2e:
image: amazon/aws-cli
stage: deploy
script:
- pwd
- ls -al
- mkdir tmp
- aws s3 sync s3://$BUCKET/latest/ tmp/
- ls -al tmp
- if ! cmp -s "tmp/notices.json" "notices.json"; then aws s3 cp notices.json s3://$BUCKET/e2e/notices.json && aws s3api put-object-acl --bucket $BUCKET --key e2e/notices.json --acl public-read && aws cloudfront create-invalidation --distribution-id $DISTRIBUTION --paths "/e2e/notices.json"; fi
variables:
BUCKET: notices.mattermost.com
DISTRIBUTION: EHBBKR634JLB1
only:
refs:
- e2etest