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 }}
0 commit comments