deploy task tweaks

This commit is contained in:
Matthias Kretschmann 2020-06-02 00:49:57 +02:00
parent dfdfa949ff
commit ef8e5117fc
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 3674 additions and 22 deletions

View File

@ -3,18 +3,10 @@
> Highlighting Botero's cat sculpture in El Raval, Barcelona<br> > Highlighting Botero's cat sculpture in El Raval, Barcelona<br>
> [https://kretschmann.cat](https://kretschmann.cat) > [https://kretschmann.cat](https://kretschmann.cat)
[![build status](https://www.git.berlin/kremalicious/kretschmann.cat/badges/master/build.svg)](https://www.git.berlin/kremalicious/kretschmann.cat/commits/master)
--- ---
## Deployment ## 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`: 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`:
``` ```
@ -23,17 +15,14 @@ aws_access_key_id = <YOUR_ACCESS_KEY_ID>
aws_secret_access_key = <YOUR_SECRET_ACCESS_KEY> aws_secret_access_key = <YOUR_SECRET_ACCESS_KEY>
``` ```
#### Fire deployment task
Continue with installing dependencies: Continue with installing dependencies:
```bash ```bash
npm install -g gulp
npm install npm install
``` ```
And finally deploy: And finally deploy:
```bash ```bash
gulp deploy npm run deploy
``` ```

View File

@ -20,22 +20,19 @@ gulp.task('deploy', function() {
// create publisher, define config // create publisher, define config
var publisher = awspublish.create({ var publisher = awspublish.create({
params: { params: {
'Bucket': S3BUCKET Bucket: S3BUCKET
}, },
'accessKeyId': process.env.AWS_ACCESS_KEY, region: S3REGION
'secretAccessKey': process.env.AWS_SECRET_KEY,
'region': S3REGION
}); });
// define custom headers // define custom headers
var headers = { var headers = {
'Cache-Control': 'max-age=315360000, no-transform, public' 'Cache-Control': 'public,max-age=0,must-revalidate'
}; };
return gulp.src(DIST + '**/*') return gulp.src(DIST + '**/*')
.pipe(publisher.publish(headers)) .pipe(publisher.publish(headers))
.pipe(publisher.sync()) // delete files in bucket that are not in local folder .pipe(publisher.sync()) // delete files in bucket that are not in local folder
.pipe(publisher.cache())
.pipe(awspublish.reporter({ .pipe(awspublish.reporter({
states: ['create', 'update', 'delete'] states: ['create', 'update', 'delete']
})); }));

3665
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,12 @@
}, },
"homepage": "https://kretschmann.cat", "homepage": "https://kretschmann.cat",
"main": "gulpfile.js", "main": "gulpfile.js",
"devDependencies": { "scripts": {
"gulp-awspublish": ">=3.0.0" "deploy": "gulp deploy"
}, },
"engines": { "devDependencies": {
"node": ">=0.10.29" "gulp": "^4.0.2",
"gulp-awspublish": ">=4.1.1"
}, },
"private": true, "private": true,
"repository": { "repository": {