-
Notifications
You must be signed in to change notification settings - Fork 166
/
appveyor.yml
159 lines (138 loc) · 5.1 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
151
152
153
154
155
156
157
158
159
#---------------------------------#
# 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:
secure: J6yWumM4mBI1P5oaw0/bUM+R3Wx6tzbLLfi+ZKxbRgbILXwhUmY3yPVlAvMulXbNCDLi5TURoJFLw0TS+28zzBWzlW4swGZ7/KCcaWVLhX/UJMo+Whsaj8iHZTdkyiXm
azure_storage_access_key_staging:
secure: VkQWxgtwz07x1YG7G6Yplg7pAiydB9agL93eesFxagSJXOFvzA7OCLoTKavMOsVwur2oQZJuYY0nRXn5njBP0D1R5IddH8+MMtBTGBhQpIqwo3x2/vfKYfxyqZ+XxNC0
azure_storage_access_key_canary:
secure: Nrn3a601MlKI8/m7cVA8q/MkhqTZ6fA9hsTpvs3/XYzGaTPOjAIu6Ul/jR8h2gyD2r9jwwZ+2Qs/EqKi9HcsXT3+XwinCOhaWVXaBHsSgL2moTc3kqBSzaZ2fBuzS84C
keycdn_prod:
secure: Huzh5ka/34JssGiAAcy3NQ==
keycdn_staging:
secure: p5v73CByqygknYvAn3Iriw==
keycdn_canary:
secure: QGLtO8+uBR7yQWidhVi2+A==
keycdn_api_key:
secure: nd3s+m12v7rzqG+/xXHfkmTX3eGxvfxk0lQSSA1ZggmFIcVEH2ABMpAv7aOXz0a7
# 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:
- ps: $splitted = $env:APPVEYOR_BUILD_VERSION.Split(".")
- ps: $version = $splitted[0] + "." + $splitted[1]
- ps: $decimalVersion = [decimal]$version
- ps: $fistversion = [decimal]1.0
- ps: >-
if ($decimalVersion -le $fistversion)
{
$version = ""
}
- ps: gulp deploy --snipcartVersion $version
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: J6yWumM4mBI1P5oaw0/bUM+R3Wx6tzbLLfi+ZKxbRgbILXwhUmY3yPVlAvMulXbNCDLi5TURoJFLw0TS+28zzBWzlW4swGZ7/KCcaWVLhX/UJMo+Whsaj8iHZTdkyiXm
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: VkQWxgtwz07x1YG7G6Yplg7pAiydB9agL93eesFxagSJXOFvzA7OCLoTKavMOsVwur2oQZJuYY0nRXn5njBP0D1R5IddH8+MMtBTGBhQpIqwo3x2/vfKYfxyqZ+XxNC0
container: themes
artifact: themes
set_content_type: true
unzip: true
on:
branch: staging
# Canary
- provider: AzureBlob
storage_account_name: snipcartcdncanary
storage_access_key:
secure: Nrn3a601MlKI8/m7cVA8q/MkhqTZ6fA9hsTpvs3/XYzGaTPOjAIu6Ul/jR8h2gyD2r9jwwZ+2Qs/EqKi9HcsXT3+XwinCOhaWVXaBHsSgL2moTc3kqBSzaZ2fBuzS84C
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
}