forked from snipcart/snipcart-theme-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.yml
150 lines (129 loc) · 4.78 KB
/
appveyor.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#---------------------------------#
# general configuration #
#---------------------------------#
# version format
version: 2.0.{build}-{branch}
# branches to build
branches:
# whitelist
only:
- master
- staging
- canary
- v1.0
- v2.0
#---------------------------------#
# environment configuration #
#---------------------------------#
# environment variables
environment:
NODE_UNICODETABLE_UNICODEDATA_TXT: '%appveyor_build_folder%\tools\UnicodeData.txt'
nodejs_version: "8"
azure_storage_access_key_staging:
secure: LPX3Gv4dUzZ187kD3CZMsRWR1qNB9UM287fR1vh6FD4zAtUTzbPc5Hrh4syNokgYVPEN7JHxN0NL8Vt13DeCvW4STUyyFK+VgdDt5nTseMRsNbVST6ZYqmN19mF15yzi
azure_storage_access_key:
secure: pLJQvFOvO9DWeIX7KGdhUOSyEL7IH8CPegPlFMeZNod2fCeQIZ679KR8deYzrGeWKOAPi8j1+P0m4RSuorWnvXrU2MrJaxer912WbQHZ4Z/D8Q4kGFFwU3siJS9OzOap
azure_storage_access_key_canary:
secure: qvb26x/k1hCCVODmVKvc3c+3JHg1WX3VSmoI2KGLD6QE9WF+eSV4+4H71Qv9ORfz388G6B2VxM1JxHKRshwCZ59kbdRicpYE2ClEwGFxvROxlrzuGob9Bh0BvBHUDWPV
keycdn_api_key:
secure: HIuW8miNWA5qAAW3BGGQTMoxFlnWsoc4c9b4Yy1Eo9MYnHFNTjtV9BFdsm8pfLxj
keycdn_prod:
secure: J4aOP8rLKXjQ8hUVl0suBg==
keycdn_staging:
secure: 93E/Z5lVFdeq8uw87xvuZg==
keycdn_canary:
secure: mTyxClT8rVXIAfmz+DnIdQ==
# scripts that are called at very beginning, before repo cloning
init:
- npm install gulp -g
- git config --global core.autocrlf input
# scripts that run after cloning repository
install:
- ps: Install-Product node $env:nodejs_version
- npm install
#---------------------------------#
# build configuration #
#---------------------------------#
build_script:
- gulp deploy
after_build:
- cd dist\themes
- 7z a %APPVEYOR_BUILD_FOLDER%\themes.zip "**\*.*" -r -x!".gitkeep" -x!".gitignore" -x!"*.map"
#---------------------------------#
# artifacts configuration #
#---------------------------------#
artifacts:
# pushing a single file
- path: themes.zip
name: themes
type: zip
deploy:
# Production
- provider: AzureBlob
storage_account_name: snipcartpublic
storage_access_key:
secure: pLJQvFOvO9DWeIX7KGdhUOSyEL7IH8CPegPlFMeZNod2fCeQIZ679KR8deYzrGeWKOAPi8j1+P0m4RSuorWnvXrU2MrJaxer912WbQHZ4Z/D8Q4kGFFwU3siJS9OzOap
container: themes
artifact: themes
set_content_type: true
unzip: true
on:
branch:
- master
- v1.0
- v2.0
# Staging
- provider: AzureBlob
storage_account_name: snipcartcdndev
storage_access_key:
secure: LPX3Gv4dUzZ187kD3CZMsRWR1qNB9UM287fR1vh6FD4zAtUTzbPc5Hrh4syNokgYVPEN7JHxN0NL8Vt13DeCvW4STUyyFK+VgdDt5nTseMRsNbVST6ZYqmN19mF15yzi
container: themes
artifact: themes
set_content_type: true
unzip: true
on:
branch: staging
# Canary
- provider: AzureBlob
storage_account_name: snipcartcdncanary
storage_access_key:
secure: qvb26x/k1hCCVODmVKvc3c+3JHg1WX3VSmoI2KGLD6QE9WF+eSV4+4H71Qv9ORfz388G6B2VxM1JxHKRshwCZ59kbdRicpYE2ClEwGFxvROxlrzuGob9Bh0BvBHUDWPV
container: themes
artifact: themes
set_content_type: true
unzip: true
on:
branch: canary
after_deploy:
- ps: >-
$auth = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $env:keycdn_api_key,"")))
if (($env:APPVEYOR_REPO_BRANCH -eq "production"))
{
$url = "https://api.keycdn.com/zones/purge/{0}.json" -f $env:keycdn_prod
Add-AppveyorMessage "Purging PRODUCTION CDN"
Invoke-RestMethod -Headers @{Authorization=("Basic {0}" -f $auth)} -Uri $url
}
if (($env:APPVEYOR_REPO_BRANCH -eq "master"))
{
$url = "https://api.keycdn.com/zones/purge/{0}.json" -f $env:keycdn_prod
Add-AppveyorMessage "Purging PRODUCTION CDN"
Invoke-RestMethod -Headers @{Authorization=("Basic {0}" -f $auth)} -Uri $url
}
if (($env:APPVEYOR_REPO_BRANCH -eq "v2.0"))
{
$url = "https://api.keycdn.com/zones/purge/{0}.json" -f $env:keycdn_prod
Add-AppveyorMessage "Purging PRODUCTION CDN"
Invoke-RestMethod -Headers @{Authorization=("Basic {0}" -f $auth)} -Uri $url
}
if (($env:APPVEYOR_REPO_BRANCH -eq "staging"))
{
$url = "https://api.keycdn.com/zones/purge/{0}.json" -f $env:keycdn_staging
Add-AppveyorMessage "Purging STAGING CDN"
Invoke-RestMethod -Headers @{Authorization=("Basic {0}" -f $auth)} -Uri $url
}
if (($env:APPVEYOR_REPO_BRANCH -eq "canary"))
{
$url = "https://api.keycdn.com/zones/purge/{0}.json" -f $env:keycdn_canary
Add-AppveyorMessage "Purging STAGING CDN"
Invoke-RestMethod -Headers @{Authorization=("Basic {0}" -f $auth)} -Uri $url
}