Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add automatic master branch deployment

Artur Smęt0e991bb375a2
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 1cef56ed2f..ba4105222f 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -40,18 +40,30 @@ jobs:
docker push mirumee/saleor:$CIRCLE_SHA1
docker push mirumee/saleor:latest
apk add --upgrade --no-cache curl libcurl
- curl -u $DEMO_DEPLOY_KEY: \
- -d build_parameters[CIRCLE_JOB]=deploy \
- https://circleci.com/api/v1.1/project/github/mirumee/saleor-demo/tree/master
+
+ - run:
+ name: Deploy saleor-demo
+ command: |
+ if [ -n "$CIRCLE_TAG" ]; then
+ curl -u $DEMO_DEPLOY_KEY: \
+ -d build_parameters[CIRCLE_JOB]=deploy \
+ https://circleci.com/api/v1.1/project/github/mirumee/saleor-demo/tree/master
+ - run:
+ name: Deploy saleor master
+ command: |
+ ./deploy_master.sh
+
workflows:
version: 2
- build-demo:
+ build-deploy:
jobs:
- build:
filters:
branches:
- ignore: /.*/
+ only:
+ - master
+ - feature/master-deployment
tags:
only: /demo.*/
diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json
new file mode 100644
index 0000000000..94d7405e47
--- /dev/null
+++ b/Dockerrun.aws.json
@@ -0,0 +1,12 @@
+{
+ "AWSEBDockerrunVersion": "1",
+ "Image": {
+ "Name": "mirumee/saleor:latest",
+ "Update": "true"
+ },
+ "Ports": [
+ {
+ "ContainerPort": "8000"
+ }
+ ]
+ }
diff --git a/deploy_master.sh b/deploy_master.sh
new file mode 100755
index 0000000000..d618b3b5c4
--- /dev/null
+++ b/deploy_master.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=$CIRCLE_SHA1
+ZIP=$VERSION.zip
+
+zip -r $ZIP Dockerrun.aws.json
+
+aws s3 cp $ZIP s3://$VERSIONS_BUCKET/$ZIP
+
+aws elasticbeanstalk create-application-version --application-name saleor-demo \
+ --version-label $VERSION --source-bundle S3Bucket=$VERSIONS_BUCKET,S3Key=$ZIP
+
+# Update the environment to use the new application version
+aws elasticbeanstalk update-environment --environment-name $MASTER_ENV_NAME \
+ --version-label $VERSION