-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitbucket-pipelines.yml
150 lines (148 loc) · 5.86 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
image: node:16.13.0
definitions:
steps:
- step: &build-env-version
name: Build App - ENV Version
caches:
- node
script:
- npm install
# allow use of font-awesome pro via our token
- FONTAWESOME_NPM_AUTH_TOKEN=${FONTAWESOME_NPM_AUTH_TOKEN} npm install --save @fortawesome/fontawesome-pro
- VUE_APP_ENVIRONMENT=${ENV} npm run ${BUILD_COMMAND}
- mkdir -p upload/${ENV}/
- mv dist/* upload/${ENV}
artifacts:
- upload/**
- step: &deploy
name: Deploy to S3
script:
- pipe: atlassian/aws-s3-deploy:0.3.8
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: us-west-2
S3_BUCKET: arcimoto-palantir
LOCAL_PATH: upload
- step: &email-deploy-completion
name: Deploy Completion Email
script:
- email=$(git log --format='%ae' ${BITBUCKET_COMMIT}^!)
- BB_LINK="https://bitbucket.org/${BITBUCKET_WORKSPACE}/${BITBUCKET_REPO_SLUG}/"
- HEADER="#Palantir Deploy to ${ENV} Complete"
- CONTENT="The pipeline for the [palantir](${BB_LINK}) repo has completed deploying the app."
- LINK="- [Palantir ${ENV} Version](${APP_LINK})"
- BUILD_LINK="- [Pipeline Execution ${BITBUCKET_BUILD_NUMBER}](${BB_LINK}/addon/pipelines/home#!/results/${BITBUCKET_BUILD_NUMBER})"
- printf "$HEADER\n\n$CONTENT\n\n$LINK\n$BUILD_LINK" | docker run -i datafolklabs/markdown > email_body.html
- pipe: atlassian/email-notify:0.4.5
variables:
USERNAME: $SES_SMTP_USERNAME
PASSWORD: $SES_SMTP_PASSWORD
FROM: [email protected]
TO: $email
SUBJECT: Palantir - $ENV Deploy Complete
HOST: email-smtp.us-west-2.amazonaws.com
BODY_HTML: email_body.html
- step: &email-release-notification
name: Release Notify Email
script:
- version=$(node -pe "require('./package.json').version")
- HEADER="#Palantir Release Complete - ${version}"
- CONTENT="A new version of Palantir (${version}) has been released. This new release is available at the normal Palantir URL, included below."
- LINK="- [Palantir ${version}](${APP_LINK})"
- printf "$HEADER\n\n$CONTENT\n\n$LINK" | docker run -i datafolklabs/markdown > email_body.html
- pipe: atlassian/email-notify:0.4.5
variables:
USERNAME: $SES_SMTP_USERNAME
PASSWORD: $SES_SMTP_PASSWORD
FROM: [email protected]
SUBJECT: Palantir New Release - ${version}
HOST: email-smtp.us-west-2.amazonaws.com
BODY_HTML: email_body.html
ATTACHMENTS: CHANGELOG.md
- step: &email-tests-completion
name: Tests Completion Email
script:
- email=$(git log --format='%ae' ${BITBUCKET_COMMIT}^!)
- BB_LINK="https://bitbucket.org/${BITBUCKET_WORKSPACE}/${BITBUCKET_REPO_SLUG}/"
- HEADER="#Palantir App Build Tests Complete"
- CONTENT="The pipeline running tests for the [palantir](${BB_LINK}) repo has completed."
- BUILD_LINK="- [Pipeline Execution ${BITBUCKET_BUILD_NUMBER}](${BB_LINK}/addon/pipelines/home#!/results/${BITBUCKET_BUILD_NUMBER})"
- PR_LINK="- [Pull Request ${BITBUCKET_PR_ID}](${BB_LINK}/pull-requests/${BITBUCKET_PR_ID})"
- printf "$HEADER\n\n$CONTENT\n\n$BUILD_LINK\n$PR_LINK" | docker run -i datafolklabs/markdown > email_body.html
- pipe: atlassian/email-notify:0.4.5
variables:
USERNAME: $SES_SMTP_USERNAME
PASSWORD: $SES_SMTP_PASSWORD
FROM: [email protected]
TO: $email
SUBJECT: Palantir - Tests Complete for Pull Request ${BITBUCKET_PR_ID}
HOST: email-smtp.us-west-2.amazonaws.com
BODY_HTML: email_body.html
- step: &update-version
name: Update Version
caches:
- node
script:
- npm install
- npx semantic-release
artifacts:
- package.json # carrying this to subsequent steps forces any builds onto the new version number
- CHANGELOG.md
pipelines:
pull-requests:
'TEL-*':
- step:
<<: *build-env-version
deployment: Development
name: Test Build App - development build
- step:
<<: *build-env-version
deployment: Production
name: Test Build App - production build
- step:
<<: *email-tests-completion
deployment: ProductionEmail
branches:
dev:
- step:
deployment: Development
<<: *build-env-version
name: Build App - Dev ENV
- step: *deploy
- step:
<<: *email-deploy-completion
deployment: DevelopmentEmail
staging:
- step:
deployment: Staging
<<: *build-env-version
name: Build App - Staging ENV
- step: *deploy
- step:
<<: *email-deploy-completion
deployment: StagingEmail
master:
- step:
<<: *update-version
deployment: UpdateVersion
- step:
deployment: Development
<<: *build-env-version
name: Build App - Dev ENV
- step:
deployment: Staging
<<: *build-env-version
name: Build App - Staging ENV
- step:
deployment: Production
<<: *build-env-version
name: Build App - Prod ENV
- step: *deploy
- step:
<<: *email-deploy-completion
deployment: ProductionEmail
- step:
<<: *email-release-notification
deployment: ReleaseEmail