-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitbucket-pipelines.yml
62 lines (55 loc) · 1.5 KB
/
bitbucket-pipelines.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
image:
name: 097427577457.dkr.ecr.ap-south-1.amazonaws.com/pipeline81:latest
aws:
access-key: $AWS_ACCESS_KEY_ID
secret-key: $AWS_SECRET_ACCESS_KEY
options:
docker: true
release: &release
name: Tag the release
script:
- '[ -f "account.txt" ] && export ACCOUNT_NAME=$(cat account.txt)'
- export AWS_ACCOUNT=${ACCOUNT_NAME:-DEV}
- echo "Releasing to ${AWS_ACCOUNT} account"
- bash ./deployer
- bash ./scripts/git
artifacts:
- RELEASE
deployment: &deployment
name: "Deploy to serverless"
script:
- git fetch --all --tags -f
- '[ -f "account.txt" ] && export ACCOUNT_NAME=$(cat account.txt)'
- '[ -f "RELEASE" ] && export TAG_NAME=$(cat RELEASE)'
- '[ ! -z "${TAG_NAME}" ] && git checkout tags/${TAG_NAME} && export BITBUCKET_TAG=${TAG_NAME}'
- export AWS_ACCOUNT=${ACCOUNT_NAME:-DEV}
- echo "Releasing to ${AWS_ACCOUNT} account"
- bash ./deployer
- bash ./scripts/deploy
account: &account
name: "Setup deployment account"
script:
- touch account.txt && echo ${ACCOUNT} > account.txt
artifacts:
- account.txt
pipelines:
custom:
release:
- variables:
- name: TAG_PREFIX
default: v
- step: *release
deployment:
- variables:
- name: TAG_NAME
default: v-latest
- name: ACCOUNT_NAME
default: DEV
- step: *deployment
tags:
prod-*:
- step: *account
- step: *release
- step: *deployment
dev-*:
- step: *deployment