diff --git a/.awspublish-kretschmann.cat b/.awspublish-kretschmann.cat new file mode 100644 index 0000000..ad6e1dc --- /dev/null +++ b/.awspublish-kretschmann.cat @@ -0,0 +1 @@ +{"index.html":"\"1796b44249fce697b13d7d66f3785d8c\"","assets/gato-del-raval.jpg":"\"ac14e6eccb5af4b70fb58097485a1c7f\"","assets/style.css":"\"12069179d6731702163f4b1080e23896\""} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..6a0e43c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,12 @@ +image: node:latest + +cache: + paths: + - node_modules/ + +deploy: + only: + - master + script: + - npm install + - gulp deploy diff --git a/README.md b/README.md index e5a0383..498fe16 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,38 @@ > Highlighting Botero's cat sculpture in El Raval, Barcelona +gato del raval + +[![build status](https://www.git.berlin/kremalicious/kretschmann.cat/badges/master/build.svg)](https://www.git.berlin/kremalicious/kretschmann.cat/commits/master) + --- [https://kretschmann.cat](https://kretschmann.cat) + +## Deployment + +Just push to master and git.berlin CI will do the rest. + +### Manual deployment + +#### Prerequisite: Authentication + +To deploy the site, you must authenticate yourself against the AWS API with your AWS credentials. Get your AWS access key and secret and add them to `~/.aws/credentials`: + +``` +[default] +aws_access_key_id = +aws_secret_access_key = +``` + +Continue with installing dependencies: + +```bash +npm install +`` + +And finally deploy: + +```bash +gulp deploy +`` diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..d724bf7 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,42 @@ +'use strict'; + +var gulp = require('gulp'), + awspublish = require('gulp-awspublish') + +// paths +var DIST = './site/'; + +// deployment +var S3BUCKET = 'kretschmann.cat', + S3REGION = 'eu-central-1'; + + +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// Deployment +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +gulp.task('deploy', function() { + + // create publisher, define config + var publisher = awspublish.create({ + params: { + 'Bucket': S3BUCKET + }, + 'accessKeyId': process.env.AWS_ACCESS_KEY, + 'secretAccessKey': process.env.AWS_SECRET_KEY, + 'region': S3REGION + }); + + // define custom headers + var headers = { + 'Cache-Control': 'max-age=315360000, no-transform, public' + }; + + return gulp.src(DIST + '**/*') + .pipe(publisher.publish(headers)) + .pipe(publisher.sync()) // delete files in bucket that are not in local folder + .pipe(publisher.cache()) + .pipe(awspublish.reporter({ + states: ['create', 'update', 'delete'] + })); +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..f84c3d5 --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "kretschmann-cat", + "version": "1.0.0", + "author": { + "name": "Matthias Kretschmann", + "email": "m@kretschmann.io" + }, + "homepage": "https://kretschmann.cat", + "main": "gulpfile.js", + "devDependencies": { + "gulp": ">=3.9.0", + "gulp-awspublish": ">=3.0.0" + }, + "engines": { + "node": ">=0.10.29" + }, + "private": true, + "repository": { + "type": "git", + "url": "https://www.git.berlin/kremalicious/kretschmann.cat.git" + } +} diff --git a/assets/gato-del-raval.jpg b/site/assets/gato-del-raval.jpg similarity index 100% rename from assets/gato-del-raval.jpg rename to site/assets/gato-del-raval.jpg diff --git a/assets/style.css b/site/assets/style.css similarity index 100% rename from assets/style.css rename to site/assets/style.css diff --git a/index.html b/site/index.html similarity index 100% rename from index.html rename to site/index.html