-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwercker.yml
More file actions
78 lines (67 loc) · 2.33 KB
/
wercker.yml
File metadata and controls
78 lines (67 loc) · 2.33 KB
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
dev:
box: youpic/node-beanstalk:0.12.2
steps:
- nahody/npm-install@1.1.1:
environment: development
- internal/watch:
code: npm run watch
build:
box: youpic/node-beanstalk:0.12.2
steps:
- nahody/npm-install@1.1.1:
environment: production
- script:
name: make symlink
code: |
ln -s $WERCKER_SOURCE_DIR /usr/src/app
- script:
name: export release tag
code: |
export RELEASE_TAG=$(git describe --tag --exact-match $WERCKER_GIT_COMMIT 2>/dev/null || echo $WERCKER_GIT_COMMIT)
- script:
name: echo release tag
code: |
echo $RELEASE_TAG
# Push the image to docker hub
- internal/docker-push:
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
tag: $RELEASE_TAG
repository: example/repository
registry: https://registry.hub.docker.com
cmd: sh -c 'cd /usr/src/app; npm start'
- nahody/npm-install@1.1.1:
environment: development
- npm-test
after-steps:
- slack-notifier:
url: $SLACK_WEBHOOK_URL
channel: builds
username: wercker
deploy:
box: youpic/deploy-beanstalk
steps:
- script:
name: export release tag
code: |
export RELEASE_TAG=$(git describe --tag --exact-match $WERCKER_GIT_COMMIT 2>/dev/null || echo $WERCKER_GIT_COMMIT)
- script:
name: echo release tag
code: |
echo $RELEASE_TAG
- script:
name: deploy to beanstalk
code: |
BUCKET="s3-bucket-name"
KEY="${RELEASE_TAG}-Dockerrun.aws.json"
APP_NAME="name-of-aws-app"
ENVIRONMENT_NAME="name-of-aws-environment"
sed "s/VERSION/${RELEASE_TAG}/g" ${WERCKER_SOURCE_DIR}/Dockerrun.aws.json.template > ./Dockerrun.aws.json
aws s3 cp ./Dockerrun.aws.json "s3://${BUCKET}/${KEY}"
if aws elasticbeanstalk create-application-version --application-name $APP_NAME --version-label $RELEASE_TAG --source-bundle S3Bucket=$BUCKET,S3Key=$KEY 2>&1 | grep "InvalidParameterValue.*already exists" || echo $? && (($? == 0)); then echo "Successfully created application"; else echo $?; exit $?; fi;
aws elasticbeanstalk update-environment --environment-name $ENVIRONMENT_NAME --version-label $RELEASE_TAG
after-steps:
- slack-notifier:
url: $SLACK_WEBHOOK_URL
channel: builds
username: wercker