Skip to content

Instantly share code, notes, and snippets.

@KerryRitter
Last active August 24, 2020 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KerryRitter/9d67612b999a29925dffc3cb1b02ae18 to your computer and use it in GitHub Desktop.
Save KerryRitter/9d67612b999a29925dffc3cb1b02ae18 to your computer and use it in GitHub Desktop.
AST deploy script idea
module.exports = {
dev: {
awsProfile: "personal",
s3SyncFolder: "./dist",
cfnStackName: "buciconst-site-dev",
cfnParameters: {
DomainName: "dev.buciconst.com",
S3BucketName: "buciconst-site-dev",
HostedZoneId: "Z25106862SEX1JCZUOS3A",
CertificateArn: "arn:aws:acm:us-east-1:908192590524:certificate/0b108f58-f2dc-4ff1-938e-62b43fe42991"
}
},
prod: {
awsProfile: "personal",
s3SyncFolder: "./dist",
cfnStackName: "buciconst-site-prod",
cfnParameters: {
DomainName: "www.buciconst.com",
S3BucketName: "buciconst-site-prod",
HostedZoneId: "Z25106862SEX1JCZUOS3A",
CertificateArn: "arn:aws:acm:us-east-1:908192590524:certificate/0b108f58-f2dc-4ff1-938e-62b43fe42991"
}
}
}
class MyCustomStep() {
run() {
}
}
module.exports = ({context, args}) => {
const { cfn, s3, cloudfront, nest, ast } = context.getToolSets('cfn', 's3', 'cloudfront', 'nest', 'ast');
const config = require('./config')[args.env];
const zipComplete = new Subject();
return {
chain: [
new MyCustomStep(),
new npm.Install({ condition: !args.skipInstall }),
new nest.Build({ condition: !args.skipBuild }),
new npm.Prune({ condition: !args.skipPrune, args: ['--production'] }),
new ast.Zip({ condition: !args.skipZip, complete$: zipComplete, }),
new cfn.Package({
stackName, parameters, tags, etc
}),
new cfn.Deploy({
stackName, parameters, tags, etc
}),
],
}
};
{
"name": "old-site",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"deploy:dev": "ast ./cfn/deploy.js --env=dev --skipInstall=true",
"deploy:prod": "ast ./cfn/deploy.js --env=dev --skipInstall=true"
},
"author": "",
"license": "ISC"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment