FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
aws-codedeploy-samples/version-control/git/pre-push at master · TheDeveloper/aws-codedeploy-samples · GitHub
TheDeveloper
/
aws-codedeploy-samples
Public
forked from
aws-samples/aws-codedeploy-samples
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
aws-codedeploy-samples
/
version-control
/
git
/
pre-push
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
45 lines (38 loc) · 1.92 KB
Breadcrumbs
aws-codedeploy-samples
/
version-control
/
git
/
pre-push
Copy path
File metadata and controls
executable file
·
45 lines (38 loc) · 1.92 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!
/bin/bash
#
Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
#
Licensed under the Apache License, Version 2.0 (the "License").
#
You may not use this file except in compliance with the License.
#
A copy of the License is located at
#
#
http://aws.amazon.com/apache2.0
#
#
or in the "license" file accompanying this file. This file is distributed
#
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
#
express or implied. See the License for the specific language governing
#
permissions and limitations under the License.
AWS=
"
/usr/local/bin/aws
"
APPLICATION_NAME=
$(
git config --get aws-codedeploy.application-name
)
DEPLOYMENT_GROUP=
$(
git config --get aws-codedeploy.deployment-group
)
BUCKET_NAME=
$(
git config --get aws-codedeploy.s3bucket
)
BUNDLE_NAME=
$(
echo
$(
basename
`
pwd
`
)
.zip
)
#
`aws deploy push` will overwrite the bundle in S3. If you'd rather ensure that you have a unique
#
object for each push, you could, for example, append the commit hash:
#
BUNDLE_NAME=$(echo $(basename `pwd`)-$(git log -n 1 --format=%H).zip)
#
Call `aws deploy push` to create a new revision of the current repo
echo
"
Pushing
$BUNDLE_NAME
to s3://
${BUCKET_NAME}
and registering with application '
${APPLICATION_NAME}
'
"
1>&2
$AWS
deploy push \
--application-name
${APPLICATION_NAME}
\
--s3-location s3://
${BUCKET_NAME}
/
${BUNDLE_NAME}
\
--ignore-hidden-files \
--source
.
revision_json=
"
{
\"
revisionType
\"
:
\"
S3
\"
,
\"
s3Location
\"
:{
\"
bucket
\"
:
\"
${BUCKET_NAME}
\"
,
\"
bundleType
\"
:
\"
zip
\"
,
\"
key
\"
:
\"
${BUNDLE_NAME}
\"
}}
"
if
[
$?
!=
0 ]
;
then
echo
"
Push to codedeploy failed; skipping create-deployment
"
1>&2
else
echo
"
Deploying s3://
${BUCKET_NAME}
/
${BUNDLE_NAME}
to application
${APPLICATION_NAME}
and deployment group
${DEPLOYMENT_GROUP}
"
1>&2
$AWS
deploy create-deployment \
--application-name
${APPLICATION_NAME}
\
--deployment-group-name
${DEPLOYMENT_GROUP}
\
--revision
$revision_json
fi
Back
|
FazBrowse Home
|
New Git URL