-
Notifications
You must be signed in to change notification settings - Fork 5
/
.travis.yml
72 lines (65 loc) · 2.28 KB
/
.travis.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
language: python
cache:
apt: true
pip: true
before_install:
- set -e
- export STARTTIME="$(date +%s)"
- sudo apt-get -qq update
- sudo apt-get install -y libyaml-dev
- wget https://github.com/gohugoio/hugo/releases/download/v0.55.6/hugo_extended_0.55.6_Linux-64bit.deb
- sudo dpkg -i hugo*.deb
- if [ "$TRAVIS_BRANCH" == "dev" ]; then
AWS_BUCKET="www.dev.ror.community";
cp dev.toml config.toml;
CLOUDFRONT_DISTRIBUTION_ID=$CLOUDFRONT_DISTRIBUTION_ID_DEV;
AUTO_DEPLOY=true;
elif [ "$TRAVIS_BRANCH" == "staging" ]; then
AWS_BUCKET="www.staging.ror.community";
cp staging.toml config.toml;
CLOUDFRONT_DISTRIBUTION_ID=$CLOUDFRONT_DISTRIBUTION_ID_STAGING;
AUTO_DEPLOY=true;
elif [ "$TRAVIS_BRANCH" == "master" ]; then
AWS_BUCKET="main.ror.community";
cp live.toml config.toml;
CLOUDFRONT_DISTRIBUTION_ID=$CLOUDFRONT_DISTRIBUTION_ID;
AUTO_DEPLOY=true;
fi
- export CR_AUTHOR_NAME="$(git log -1 $TRAVIS_COMMIT --pretty="%aN")"
- echo "*Commit message:* \"$TRAVIS_COMMIT_MESSAGE\"" | ./scripts/slacktee -p
- echo "*Committed by:* $CR_AUTHOR_NAME" | ./scripts/slacktee -p
install:
- sudo pip install awscli
script:
- echo "On branch $TRAVIS_BRANCH" | ./scripts/slacktee -p
- echo "Target $AWS_BUCKET" | ./scripts/slacktee -p
- echo "Starting site build..." | ./scripts/slacktee -p
- hugo -v |& ./scripts/slacktee
- echo "Finished site build." | ./scripts/slacktee -p
before_deploy:
- echo "Copying new content to $AWS_BUCKET..." | ./scripts/slacktee -p
deploy:
provider: s3
access_key_id: $AWS_ACCESS_KEY
secret_access_key: $AWS_SECRET_KEY
bucket: $AWS_BUCKET
region: eu-west-1
skip_cleanup: true
local_dir: public
acl: public_read
cache_control: "max-age=31536000"
on:
branch:
- master
- staging
- dev
after_deploy:
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_KEY
# Allow `awscli` to make requests to CloudFront.
- aws configure set preview.cloudfront true
# Invalidate every object in the targeted distribution.
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
- echo "Finshed copying new content to server." | ./scripts/slacktee -p
notifications:
email: false