forked from masastack/MASA.Blazor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
127 lines (117 loc) · 2.95 KB
/
.gitlab-ci.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
stages:
- packer
- docker
- deploy-dev
- deploy-test
- packer-prd
- docker-prd
- deploy-prd
- tag
variables:
IMAGE: registry.cn-hangzhou.aliyuncs.com/masa/masa-blazor-docs:0.2.$CI_PIPELINE_ID
IMAGE_PRD: registry.cn-hangzhou.aliyuncs.com/masa/masa-blazor-docs:$CI_COMMIT_TAG
packer:
stage: packer
tags:
- linux-shell
only:
- main
script:
- ls
- ls src/
- node -v
- dotnet --version
- git clone -b main https://github.com/BlazorComponent/BlazorComponent.git ./src/BlazorComponent
- dotnet build src
- dotnet pack src --include-symbols -p:PackageVersion=0.2.$CI_PIPELINE_ID
- dotnet nuget push "**/*.symbols.nupkg" -k $nugetkey -s https://api.nuget.org/v3/index.json
artifacts:
expire_in: 1 day
paths:
- ./src/BlazorComponent
retry: 2
docker:
stage: docker
tags:
- linux-shell
before_script:
- docker login -u $CI_ALI_REGISTRY_USER -p $CI_ALI_REGISTRY_PASSWD $CI_ALI_REGISTRY_DOMAIN
only:
- branches
script:
- docker build -t $IMAGE .
- docker push $IMAGE
- docker rmi $IMAGE
after_script:
- rm -rf ./src/BlazorComponent
retry: 2
deploy-dev:
image: portainer/kubectl-shell
stage: deploy-dev
only:
- main
script:
- echo $KUBE_CONFIG_DEV | base64 -d > ./config
- kubectl --kubeconfig ./config set image deployment/masa-blazor-docs masa-blazor-docs=$IMAGE -n masa-blazor
retry: 2
deploy-test:
image: portainer/kubectl-shell
stage: deploy-test
only:
- main
script:
- echo $KUBE_CONFIG_DEV | base64 -d > ./config
- kubectl --kubeconfig ./config set image deployment/masa-blazor-docs masa-blazor-docs=$IMAGE -n test-masa-blazor
retry: 2
packer-prd:
stage: packer-prd
tags:
- linux-shell
only:
- tags
script:
- dotnet --version
- git clone -b main https://github.com/BlazorComponent/BlazorComponent.git ./src/BlazorComponent
- dotnet build src
- dotnet pack src --include-symbols -p:PackageVersion=$CI_COMMIT_TAG
- dotnet nuget push "**/*.symbols.nupkg" -k $nugetkey -s https://api.nuget.org/v3/index.json
artifacts:
expire_in: 1 day
paths:
- ./src/BlazorComponent
retry: 2
docker-prd:
stage: docker-prd
tags:
- linux-shell
before_script:
- docker login -u $CI_ALI_REGISTRY_USER -p $CI_ALI_REGISTRY_PASSWD $CI_ALI_REGISTRY_DOMAIN
only:
- tags
script:
- docker build -t $IMAGE_PRD .
- docker push $IMAGE_PRD
retry: 2
deploy-prd:
image: portainer/kubectl-shell
stage: deploy-prd
only:
- tags
script:
- echo $KUBE_CONFIG_BLAZOR_PRD | base64 -d > ./config
- kubectl --kubeconfig ./config set image deployment/masa-blazor masa-blazor=$IMAGE_PRD -n masa-blazor
retry: 2
when: manual
tag-push:
stage: tag
tags:
- linux-shell
only:
- tags
script:
- cd ./src/BlazorComponent
- echo $CI_COMMIT_TAG
- git tag $CI_COMMIT_TAG
- git push origin $CI_COMMIT_TAG
after_script:
- rm -rf ./src/BlazorComponent