forked from vuestorefront/vue-storefront
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (91 loc) · 12.3 KB
/
deploy-storefrontcloud.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Deploy to Storefrontcloud
on:
push:
branches:
- master
- develop
- hotfix/v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Add theme
run: |
git clone --single-branch --branch master https://github.com/DivanteLtd/vsf-default.git ./src/themes/default
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: "10.x"
- name: Create config file
run: |
echo '{"server":{"useOutputCacheTagging":true,"useOutputCache":true,"dynamicConfigReload":true,"dynamicConfigInclude":["redis","elasticsearch","api","graphql","cart","products","orders","users","stock","images","mailchimp","mailer","urlModule"]},"api":{"url":"https://demo.storefrontcloud.io"},"elasticsearch":{"host":"/api/catalog"},"entities":{"attribute":{"loadByAttributeMetadata":true}},"urlModule":{"enableMapFallbackUrl":true},"redis":{"host":"redis"},"graphql":{"host":"https://demo.storefrontcloud.io/graphql"},"cart":{"create_endpoint":"https://demo.storefrontcloud.io/api/cart/create?token={{token}}","updateitem_endpoint":"https://demo.storefrontcloud.io/api/cart/update?token={{token}}&cartId={{cartId}}","deleteitem_endpoint":"https://demo.storefrontcloud.io/api/cart/delete?token={{token}}&cartId={{cartId}}","pull_endpoint":"https://demo.storefrontcloud.io/api/cart/pull?token={{token}}&cartId={{cartId}}","totals_endpoint":"https://demo.storefrontcloud.io/api/cart/totals?token={{token}}&cartId={{cartId}}","paymentmethods_endpoint":"https://demo.storefrontcloud.io/api/cart/payment-methods?token={{token}}&cartId={{cartId}}","shippingmethods_endpoint":"https://demo.storefrontcloud.io/api/cart/shipping-methods?token={{token}}&cartId={{cartId}}","shippinginfo_endpoint":"https://demo.storefrontcloud.io/api/cart/shipping-information?token={{token}}&cartId={{cartId}}","collecttotals_endpoint":"https://demo.storefrontcloud.io/api/cart/collect-totals?token={{token}}&cartId={{cartId}}","deletecoupon_endpoint":"https://demo.storefrontcloud.io/api/cart/delete-coupon?token={{token}}&cartId={{cartId}}","applycoupon_endpoint":"https://demo.storefrontcloud.io/api/cart/apply-coupon?token={{token}}&cartId={{cartId}}&coupon={{coupon}}"},"products":{"endpoint":"https://demo.storefrontcloud.io/api/product"},"orders":{"endpoint":"https://demo.storefrontcloud.io/api/order"},"users":{"endpoint":"https://demo.storefrontcloud.io/api/user","history_endpoint":"https://demo.storefrontcloud.io/api/user/order-history?token={{token}}","resetPassword_endpoint":"https://demo.storefrontcloud.io/api/user/resetPassword","changePassword_endpoint":"https://demo.storefrontcloud.io/api/user/changePassword?token={{token}}","login_endpoint":"https://demo.storefrontcloud.io/api/user/login","create_endpoint":"https://demo.storefrontcloud.io/api/user/create","me_endpoint":"https://demo.storefrontcloud.io/api/user/me?token={{token}}","refresh_endpoint":"https://demo.storefrontcloud.io/api/user/refresh"},"stock":{"endpoint":"https://demo.storefrontcloud.io/api/stock"},"images":{"baseUrl":"https://demo.storefrontcloud.io/img/"},"mailchimp":{"endpoint":"https://demo.storefrontcloud.io/api/ext/mailchimp-subscribe/subscribe"},"mailer":{"endpoint":{"send":"https://demo.storefrontcloud.io/api/ext/mail-service/send-email","token":"https://demo.storefrontcloud.io/api/ext/mail-service/get-token"}}}' > config/local-cloud-demo.json
echo '{"server":{"useOutputCacheTagging":true,"useOutputCache":true,"dynamicConfigReload":true,"dynamicConfigInclude":["redis","elasticsearch","api","graphql","cart","products","orders","users","stock","images","mailchimp","mailer","urlModule"]},"api":{"url":"https://demo.storefrontcloud.io"},"elasticsearch":{"host":"/api/catalog"},"entities":{"attribute":{"loadByAttributeMetadata":true}},"urlModule":{"enableMapFallbackUrl":true},"redis":{"host":"redis"},"graphql":{"host":"https://demo.storefrontcloud.io/graphql"},"cart":{"create_endpoint":"https://demo.storefrontcloud.io/api/cart/create?token={{token}}","updateitem_endpoint":"https://demo.storefrontcloud.io/api/cart/update?token={{token}}&cartId={{cartId}}","deleteitem_endpoint":"https://demo.storefrontcloud.io/api/cart/delete?token={{token}}&cartId={{cartId}}","pull_endpoint":"https://demo.storefrontcloud.io/api/cart/pull?token={{token}}&cartId={{cartId}}","totals_endpoint":"https://demo.storefrontcloud.io/api/cart/totals?token={{token}}&cartId={{cartId}}","paymentmethods_endpoint":"https://demo.storefrontcloud.io/api/cart/payment-methods?token={{token}}&cartId={{cartId}}","shippingmethods_endpoint":"https://demo.storefrontcloud.io/api/cart/shipping-methods?token={{token}}&cartId={{cartId}}","shippinginfo_endpoint":"https://demo.storefrontcloud.io/api/cart/shipping-information?token={{token}}&cartId={{cartId}}","collecttotals_endpoint":"https://demo.storefrontcloud.io/api/cart/collect-totals?token={{token}}&cartId={{cartId}}","deletecoupon_endpoint":"https://demo.storefrontcloud.io/api/cart/delete-coupon?token={{token}}&cartId={{cartId}}","applycoupon_endpoint":"https://demo.storefrontcloud.io/api/cart/apply-coupon?token={{token}}&cartId={{cartId}}&coupon={{coupon}}"},"products":{"endpoint":"https://demo.storefrontcloud.io/api/product"},"orders":{"endpoint":"https://demo.storefrontcloud.io/api/order"},"users":{"endpoint":"https://demo.storefrontcloud.io/api/user","history_endpoint":"https://demo.storefrontcloud.io/api/user/order-history?token={{token}}","resetPassword_endpoint":"https://demo.storefrontcloud.io/api/user/resetPassword","changePassword_endpoint":"https://demo.storefrontcloud.io/api/user/changePassword?token={{token}}","login_endpoint":"https://demo.storefrontcloud.io/api/user/login","create_endpoint":"https://demo.storefrontcloud.io/api/user/create","me_endpoint":"https://demo.storefrontcloud.io/api/user/me?token={{token}}","refresh_endpoint":"https://demo.storefrontcloud.io/api/user/refresh"},"stock":{"endpoint":"https://demo.storefrontcloud.io/api/stock"},"images":{"baseUrl":"https://demo.storefrontcloud.io/img/"},"mailchimp":{"endpoint":"https://demo.storefrontcloud.io/api/ext/mailchimp-subscribe/subscribe"},"mailer":{"endpoint":{"send":"https://demo.storefrontcloud.io/api/ext/mail-service/send-email","token":"https://demo.storefrontcloud.io/api/ext/mail-service/get-token"}}}' > config/local-cloud-next.json
echo '{"server":{"useOutputCacheTagging":true,"useOutputCache":true,"dynamicConfigReload":true,"dynamicConfigInclude":["redis","elasticsearch","api","graphql","cart","products","orders","users","stock","images","mailchimp","mailer","urlModule"]},"api":{"url":"https://test.storefrontcloud.io"},"elasticsearch":{"host":"/api/catalog"},"entities":{"attribute":{"loadByAttributeMetadata":true}},"urlModule":{"enableMapFallbackUrl":true},"redis":{"host":"redis"},"graphql":{"host":"https://test.storefrontcloud.io/graphql"},"cart":{"create_endpoint":"https://test.storefrontcloud.io/api/cart/create?token={{token}}","updateitem_endpoint":"https://test.storefrontcloud.io/api/cart/update?token={{token}}&cartId={{cartId}}","deleteitem_endpoint":"https://test.storefrontcloud.io/api/cart/delete?token={{token}}&cartId={{cartId}}","pull_endpoint":"https://test.storefrontcloud.io/api/cart/pull?token={{token}}&cartId={{cartId}}","totals_endpoint":"https://test.storefrontcloud.io/api/cart/totals?token={{token}}&cartId={{cartId}}","paymentmethods_endpoint":"https://test.storefrontcloud.io/api/cart/payment-methods?token={{token}}&cartId={{cartId}}","shippingmethods_endpoint":"https://test.storefrontcloud.io/api/cart/shipping-methods?token={{token}}&cartId={{cartId}}","shippinginfo_endpoint":"https://test.storefrontcloud.io/api/cart/shipping-information?token={{token}}&cartId={{cartId}}","collecttotals_endpoint":"https://test.storefrontcloud.io/api/cart/collect-totals?token={{token}}&cartId={{cartId}}","deletecoupon_endpoint":"https://test.storefrontcloud.io/api/cart/delete-coupon?token={{token}}&cartId={{cartId}}","applycoupon_endpoint":"https://test.storefrontcloud.io/api/cart/apply-coupon?token={{token}}&cartId={{cartId}}&coupon={{coupon}}"},"products":{"endpoint":"https://test.storefrontcloud.io/api/product"},"orders":{"endpoint":"https://test.storefrontcloud.io/api/order"},"users":{"endpoint":"https://test.storefrontcloud.io/api/user","history_endpoint":"https://test.storefrontcloud.io/api/user/order-history?token={{token}}","resetPassword_endpoint":"https://test.storefrontcloud.io/api/user/resetPassword","changePassword_endpoint":"https://test.storefrontcloud.io/api/user/changePassword?token={{token}}","login_endpoint":"https://test.storefrontcloud.io/api/user/login","create_endpoint":"https://test.storefrontcloud.io/api/user/create","me_endpoint":"https://test.storefrontcloud.io/api/user/me?token={{token}}","refresh_endpoint":"https://test.storefrontcloud.io/api/user/refresh"},"stock":{"endpoint":"https://test.storefrontcloud.io/api/stock"},"images":{"baseUrl":"https://test.storefrontcloud.io/img/"},"mailchimp":{"endpoint":"https://test.storefrontcloud.io/api/ext/mailchimp-subscribe/subscribe"},"mailer":{"endpoint":{"send":"https://test.storefrontcloud.io/api/ext/mail-service/send-email","token":"https://test.storefrontcloud.io/api/ext/mail-service/get-token"}}}' > config/local-cloud-test.json
- name: Build and publish docker image
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: demo-storefrontcloud-io/vue-storefront:${{ github.sha }}
registry: registry.storefrontcloud.io
username: ${{ secrets.CLOUD_USERNAME }}
password: ${{ secrets.CLOUD_PASSWORD }}
dockerfile: dev/docker/Dockerfile
buildoptions: "--compress"
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: chrnorm/deployment-action@releases/v1
name: Create GitHub deployment
id: deployment
with:
token: "${{ github.token }}"
target_url: https://demo.storefrontcloud.io
environment: production
initial_status: in_progress
- name: Deploy on demo.storefrontcloud.io
if: github.ref == 'refs/heads/master'
run: |
if curl -s -u ${{ secrets.CLOUD_USERNAME }}:${{ secrets.CLOUD_PASSWORD }} -H 'Content-Type: application/json' -X POST -d '{"code":"demo","frontContainerVersion":"${{ github.sha }}"}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then
echo "Instance updated"
else
echo "Something went wrong during the update process..."
exit 1
fi
- name: Deploy on next.storefrontcloud.io
if: contains(github.ref, 'hotfix/v')
run: |
if curl -s -u ${{ secrets.CLOUD_USERNAME }}:${{ secrets.CLOUD_PASSWORD }} -H 'Content-Type: application/json' -X POST -d '{"code":"next","frontContainerVersion":"${{ github.sha }}"}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then
echo "Instance updated"
else
echo "Something went wrong during the update process..."
exit 1
fi
- name: Deploy on test.storefrontcloud.io
if: github.ref == 'refs/heads/develop'
run: |
if curl -s -u ${{ secrets.CLOUD_USERNAME }}:${{ secrets.CLOUD_PASSWORD }} -H 'Content-Type: application/json' -X POST -d '{"code":"test","frontContainerVersion":"${{ github.sha }}"}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then
echo "Instance updated"
else
echo "Something went wrong during the update process..."
exit 1
fi
- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@releases/v1
with:
token: "${{ github.token }}"
target_url: https://demo.storefrontcloud.io
state: "success"
description: Congratulations! The deploy is done.
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@releases/v1
with:
token: "${{ github.token }}"
target_url: https://demo.storefrontcloud.io
description: Unfortunately, the instance hasn't been updated.
state: "failure"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}