Skip to content

Commit

Permalink
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions bin/ci
Original file line number Diff line number Diff line change
@@ -97,8 +97,43 @@ deploy() {
on_deploy aws s3 sync doc/ s3://crystal-api/api/$TRAVIS_BRANCH

on_deploy on_tag aws s3 sync doc/ s3://crystal-api/api/$CURRENT_TAG
on_deploy on_tag aws s3api put-object --bucket crystal-api --key api/index.html --website-redirect-location /api/$CURRENT_TAG
on_deploy on_tag aws s3api put-bucket-website --bucket crystal-api --cli-input-json "{\"WebsiteConfiguration\":{\"IndexDocument\": {\"Suffix\": \"index.html\"}, \"RoutingRules\": [{\"Condition\": { \"KeyPrefixEquals\" : \"api/latest/\" }, \"Redirect\": { \"HttpRedirectCode\" : \"302\", \"ReplaceKeyPrefixWith\" : \"api/${CURRENT_TAG}/\", \"Protocol\": \"https\", \"HostName\" : \"crystal-lang.org\"}},{\"Condition\": {\"KeyPrefixEquals\" : \"api/\", \"HttpErrorCodeReturnedEquals\": \"404\"}, \"Redirect\": { \"HttpRedirectCode\" : \"301\", \"ReplaceKeyPrefixWith\" : \"api/latest/\", \"Protocol\": \"https\", \"HostName\" : \"crystal-lang.org\"}}]}}"
cat - > .aws-config <<EOF
{
"WebsiteConfiguration": {
"IndexDocument": {
"Suffix": "index.html"
},
"RoutingRules": [
{
"Condition": {
"KeyPrefixEquals": "api/latest/"
},
"Redirect": {
"HttpRedirectCode": "302",
"ReplaceKeyPrefixWith": "api/${CURRENT_TAG}/",
"Protocol": "https",
"HostName": "crystal-lang.org"
}
},
{
"Condition": {
"KeyPrefixEquals": "api/",
"HttpErrorCodeReturnedEquals": "404"
},
"Redirect": {
"HttpRedirectCode": "301",
"ReplaceKeyPrefixWith": "api/latest/",
"Protocol": "https",
"HostName": "crystal-lang.org"
}
}
]
}
}
EOF
on_deploy on_tag cat .aws-config
on_deploy on_tag aws s3api put-bucket-website --bucket crystal-api --website-configuration .aws-config

}

prepare_build() {

0 comments on commit f816060

Please sign in to comment.