11version : 2
22jobs :
3- build :
3+ checkout_code :
44 docker :
55 - image : microsoft/dotnet:sdk
6- working_directory : ~/project
6+ working_directory : ~/AzureFunctionsIntroduction
77 steps :
88 - checkout
9- - run :
10- name : current path
11- command : pwd && ls
12- working_directory : v2/src/AzureFunctionsIntroduction
9+ - save_cache :
10+ key : v1-repo-{{ .Environment.CIRCLE_SHA1 }}
11+ paths :
12+ - ~/AzureFunctionsIntroduction
13+
14+ restore :
15+ docker :
16+ - image : microsoft/dotnet:sdk
17+ working_directory : ~/AzureFunctionsIntroduction
18+ steps :
19+ - restore_cache :
20+ key : v1-repo-{{ .Environment.CIRCLE_SHA1 }}
1321 - restore_cache :
1422 keys :
15- - nuget-cache-v1 -{{ arch }}-{{ .Branch }}-{{ checksum "v2/src/AzureFunctionsIntroduction/AzureFunctionsIntroduction.csproj" }}
23+ - v1- nuget-cache-{{ arch }}-{{ .Branch }}-{{ checksum "v2/src/AzureFunctionsIntroduction/AzureFunctionsIntroduction.csproj" }}
1624 - run :
1725 name : Restore nuget
1826 command : dotnet restore
1927 working_directory : v2/src/AzureFunctionsIntroduction
2028 - save_cache :
21- key : nuget-cache-v1 -{{ arch }}-{{ .Branch }}-{{ checksum "v2/src/AzureFunctionsIntroduction/AzureFunctionsIntroduction.csproj" }}
29+ key : v1- nuget-cache-{{ arch }}-{{ .Branch }}-{{ checksum "v2/src/AzureFunctionsIntroduction/AzureFunctionsIntroduction.csproj" }}
2230 paths :
2331 - ~/.nuget
24- - run :
25- name : Build Azure Function
26- command : dotnet publish -c Release -o ../publish
27- working_directory : v2/src/AzureFunctionsIntroduction
28- deploy :
32+
33+ build :
2934 docker :
3035 - image : microsoft/dotnet:sdk
31- working_directory : ~/project
36+ working_directory : ~/AzureFunctionsIntroduction
3237 steps :
33- - checkout
34- - run :
35- name : Install 7zip
36- command : apt-get update && apt-get install -y p7zip-full
38+ - restore_cache :
39+ key : v1-repo-{{ .Environment.CIRCLE_SHA1 }}
3740 - restore_cache :
3841 keys :
39- - nuget-cache-v1 -{{ arch }}-{{ .Branch }}-{{ checksum "v2/src/AzureFunctionsIntroduction/AzureFunctionsIntroduction.csproj" }}
42+ - v1- nuget-cache-{{ arch }}-{{ .Branch }}-{{ checksum "v2/src/AzureFunctionsIntroduction/AzureFunctionsIntroduction.csproj" }}
4043 - run :
41- name : Restore nuget
42- command : dotnet restore
44+ name : Build
45+ command : dotnet publish -c Release -o ../publish
4346 working_directory : v2/src/AzureFunctionsIntroduction
4447 - save_cache :
45- key : nuget-cache -v1-{{ arch }}-{{ .Branch }}-{{ checksum "v2/src/AzureFunctionsIntroduction/AzureFunctionsIntroduction.csproj" }}
48+ key : v1-build -v1-{{ arch }}-{{ .Branch }}-{{ checksum "v2/src/AzureFunctionsIntroduction/AzureFunctionsIntroduction.csproj" }}
4649 paths :
4750 - ~/.nuget
51+
52+ deploy :
53+ docker :
54+ - image : microsoft/dotnet:sdk
55+ working_directory : ~/AzureFunctionsIntroduction
56+ steps :
57+ - restore_cache :
58+ key : v1-repo-{{ .Environment.CIRCLE_SHA1 }}
59+ - restore_cache :
60+ keys :
61+ - v1-nuget-cache-{{ arch }}-{{ .Branch }}-{{ checksum "v2/src/AzureFunctionsIntroduction/AzureFunctionsIntroduction.csproj" }}
62+ - restore_cache :
63+ keys :
64+ - v1-build-v1-{{ arch }}-{{ .Branch }}-{{ checksum "v2/src/AzureFunctionsIntroduction/AzureFunctionsIntroduction.csproj" }}
4865 - run :
49- name : Build Azure Function
50- command : dotnet publish -c Release -o publish
51- working_directory : v2/src/AzureFunctionsIntroduction
66+ name : Install 7zip
67+ command : apt-get update && apt-get install -y p7zip-full
5268 - run :
5369 name : Pack to Zip
5470 command : 7z a artifact.zip ./publish/*
@@ -60,13 +76,47 @@ jobs:
6076
6177workflows :
6278 version : 2
63- build_and_deploy :
79+ build_V2 :
6480 jobs :
81+ - checkout_code :
82+ filters :
83+ branches :
84+ only :
85+ - develop/v2
86+ - restore :
87+ requires :
88+ - checkout_code
89+ filters :
90+ branches :
91+ only :
92+ - develop/v2
6593 - build :
94+ requires :
95+ - restore
6696 filters :
6797 branches :
6898 only :
6999 - develop/v2
100+ build_and_deploy_v2 :
101+ jobs :
102+ - checkout_code :
103+ filters :
104+ branches :
105+ only :
106+ - release/v2
107+ - restore :
108+ requires :
109+ - checkout_code
110+ filters :
111+ branches :
112+ only :
113+ - release/v2
114+ - build :
115+ requires :
116+ - restore
117+ filters :
118+ branches :
119+ only :
70120 - release/v2
71121 - deploy :
72122 requires :
0 commit comments