Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit aefa0ac

Browse files
author
Tomasz Kostuch
authored
Merge pull request #4250 from DivanteLtd/feature/gh_actions
Feature/gh actions
2 parents ff31c68 + 68cb674 commit aefa0ac

File tree

4 files changed

+109
-1
lines changed

4 files changed

+109
-1
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Deploy to Storefrontcloud
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- develop
7+
- hotfix/v*
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v1
14+
- name: Setup node
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: "10.x"
18+
- name: Build and publish docker image
19+
uses: elgohr/Publish-Docker-Github-Action@master
20+
with:
21+
name: demo-storefrontcloud-io/vue-storefront:${{ github.sha }}
22+
registry: registry.storefrontcloud.io
23+
username: ${{ secrets.CLOUD_USERNAME }}
24+
password: ${{ secrets.CLOUD_PASSWORD }}
25+
dockerfile: dev/docker/Dockerfile
26+
buildoptions: "--compress"
27+
deploy:
28+
runs-on: ubuntu-latest
29+
needs: build
30+
steps:
31+
- uses: chrnorm/deployment-action@releases/v1
32+
name: Create GitHub deployment
33+
id: deployment
34+
with:
35+
token: "${{ github.token }}"
36+
target_url: https://demo.storefrontcloud.io
37+
environment: production
38+
initial_status: in_progress
39+
- name: Deploy on demo.storefrontcloud.io
40+
if: github.ref == 'refs/heads/master'
41+
run: |
42+
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
43+
echo "Instance updated"
44+
else
45+
echo "Something went wrong during the update process..."
46+
exit 1
47+
fi
48+
- name: Deploy on next.storefrontcloud.io
49+
if: contains(github.ref, 'hotfix/v')
50+
run: |
51+
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
52+
echo "Instance updated"
53+
else
54+
echo "Something went wrong during the update process..."
55+
exit 1
56+
fi
57+
- name: Deploy on test.storefrontcloud.io
58+
if: github.ref == 'refs/heads/develop'
59+
run: |
60+
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
61+
echo "Instance updated"
62+
else
63+
echo "Something went wrong during the update process..."
64+
exit 1
65+
fi
66+
- name: Update deployment status (success)
67+
if: success()
68+
uses: chrnorm/deployment-status@releases/v1
69+
with:
70+
token: "${{ github.token }}"
71+
target_url: https://demo.storefrontcloud.io
72+
state: "success"
73+
description: Congratulations! The deploy is done.
74+
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
75+
- name: Update deployment status (failure)
76+
if: failure()
77+
uses: chrnorm/deployment-status@releases/v1
78+
with:
79+
token: "${{ github.token }}"
80+
target_url: https://demo.storefrontcloud.io
81+
description: Unfortunately, the instance hasn't been updated.
82+
state: "failure"
83+
deployment_id: ${{ steps.deployment.outputs.deployment_id }}

config/default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"invalidateCacheKey": "aeSu7aip",
1818
"invalidateCacheForwarding": false,
1919
"invalidateCacheForwardUrl": "http://localhost:8080/invalidate?key=aeSu7aip&tag=",
20-
"dynamicConfigReload": false,
20+
"dynamicConfigReload": true,
2121
"dynamicConfigContinueOnError": false,
2222
"dynamicConfigExclude": ["ssr", "storeViews", "entities", "localForage", "shipping", "boost", "query"],
2323
"dynamicConfigInclude": [],

dev/docker/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM node:10
2+
3+
ENV NODE_CONFIG_ENV=docker PM2_ARGS=--no-daemon BIND_HOST=0.0.0.0 VS_ENV=prod
4+
5+
WORKDIR /var/www
6+
7+
COPY . .
8+
9+
# Should be yarn install --production
10+
RUN apt update && apt install -y git \
11+
&& yarn install \
12+
&& yarn build
13+
14+
COPY dev/docker/vue-storefront.sh /usr/local/bin/
15+
RUN chmod a+x /usr/local/bin/vue-storefront.sh
16+
17+
ENTRYPOINT ["vue-storefront.sh"]

dev/docker/vue-storefront.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ "$VS_ENV" = 'dev' ]; then
5+
yarn dev
6+
else
7+
yarn start
8+
fi

0 commit comments

Comments
 (0)