forked from masastack/MASA.Blazor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
195 lines (182 loc) · 6.42 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
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# include:
# - project: 'louzhijian/devops'
# ref: master
# file: 'devops/sonar-scanner.yml'
stages:
- packer
- docker
- deploy-dev
- deploy-test
- packer-prd
- docker-prd
- deploy-prd
- tag
variables:
IMAGE: registry.cn-hangzhou.aliyuncs.com/masa/masa-blazor:0.2.$CI_PIPELINE_ID
IMAGE_PRD: registry.cn-hangzhou.aliyuncs.com/masa/masa-blazor-docs:$CI_COMMIT_TAG
packer:
# image: registry.cn-hangzhou.aliyuncs.com/masa/dotnet_sdk:6.0.201_wasm
image: registry.cn-hangzhou.aliyuncs.com/masa/dotnet_sdk:7.0.100_wasm_v2
# tags:
# - 51-132
stage: packer
only:
- main
script:
- id
- ls src/
- rm -rf ./src/BlazorComponent
- rm -rf ./docs/MASA.Docs
- git config --global https.https://github.com.proxy $PROXY_GATEWAY
- git config --global http.https://github.com.proxy $PROXY_GATEWAY
- git clone -b main https://github.com/masastack/BlazorComponent.git ./src/BlazorComponent
- git clone -b main https://github.com/masastack/MASA.Docs.git ./docs/MASA.Docs
# - dotnet workload install wasm-tools-net6 --temp-dir "/home/gitlab-runner/work/_temp" &&
# - dotnet workload install wasm-tools
- dotnet workload list && dotnet build Masa.Blazor.Docs.sln
# - dotnet pack pack src --include-symbols -p:PackageVersion=0.3.0-alpha.$CI_PIPELINE_ID
- dotnet pack src/Masa.Blazor/Masa.Blazor.csproj --no-build --include-symbols -p:PackageVersion=0.7.0-alpha.$CI_PIPELINE_ID
- dotnet pack src/BlazorComponent/src/Component/BlazorComponent/BlazorComponent.csproj --no-build --include-symbols -p:PackageVersion=0.7.0-alpha.$CI_PIPELINE_ID
- dotnet nuget push "**/*.symbols.nupkg" -k $nugetkey -s https://api.nuget.org/v3/index.json --skip-duplicate
after_script:
- git config --global --unset https.proxy
- git config --global --unset http.proxy
- echo "" >/home/gitlab-runner/.gitconfig
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:
- main
script:
- rm -rf ./src/BlazorComponent
- rm -rf ./docs/MASA.Docs
- git config --global https.https://github.com.proxy $PROXY_GATEWAY
- git config --global http.https://github.com.proxy $PROXY_GATEWAY
- git clone -b main https://github.com/masastack/BlazorComponent.git ./src/BlazorComponent
- git clone -b main https://github.com/masastack/MASA.Docs.git ./docs/MASA.Docs
- docker build -t $IMAGE .
- docker push $IMAGE
- docker rmi $IMAGE
after_script:
- git config --global --unset https.proxy
- git config --global --unset http.proxy
- echo "" >/home/gitlab-runner/.gitconfig
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
# when: manual
deploy-dev-ydy:
image: portainer/kubectl-shell
stage: deploy-dev
only:
- main
script:
- echo $https://github.com/masastack/MASA.Blazor.git | base64 -d > ./config
- kubectl --kubeconfig ./config set image deployment/blazor-dev blazor-dev=$IMAGE -n masa-blazor-dev
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
# when: manual
# deploy-test-ydy:
# image: portainer/kubectl-shell
# stage: deploy-test
# only:
# - main
# script:
# - echo $KUBE_CONFIG_DEV_YDY | base64 -d > ./config
# - kubectl --kubeconfig ./config set image deployment/masa-blazor-docs masa-blazor-docs=$IMAGE -n masa-blazor-test
# retry: 2
# when: manual
packer-prd:
image: registry.cn-hangzhou.aliyuncs.com/masa/dotnet_sdk:7.0.100_wasm_v2
stage: packer-prd
only:
- tags
script:
- rm -rf ./src/BlazorComponent
- rm -rf ./docs/MASA.Docs
- git config --global https.https://github.com.proxy $PROXY_GATEWAY
- git config --global http.https://github.com.proxy $PROXY_GATEWAY
- git clone -b main https://github.com/masastack/BlazorComponent.git ./src/BlazorComponent
- git clone -b main https://github.com/masastack/MASA.Docs.git ./docs/MASA.Docs
- dotnet workload list && dotnet build Masa.Blazor.Docs.sln
- dotnet pack src/Masa.Blazor/Masa.Blazor.csproj --no-build --include-symbols -p:PackageVersion=$CI_COMMIT_TAG
- dotnet pack src/BlazorComponent/src/Component/BlazorComponent/BlazorComponent.csproj --no-build --include-symbols -p:PackageVersion=$CI_COMMIT_TAG
- dotnet nuget push "**/*.symbols.nupkg" -k $nugetkey -s https://api.nuget.org/v3/index.json
after_script:
- git config --global --unset https.proxy
- git config --global --unset http.proxy
- echo "" >/home/gitlab-runner/.gitconfig
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:
- rm -rf ./src/BlazorComponent
- rm -rf ./docs/MASA.Docs
- git config --global https.https://github.com.proxy $PROXY_GATEWAY
- git config --global http.https://github.com.proxy $PROXY_GATEWAY
- git clone -b main https://github.com/masastack/BlazorComponent.git ./src/BlazorComponent
- git clone -b main https://github.com/masastack/MASA.Docs.git ./docs/MASA.Docs
- docker build -t $IMAGE_PRD .
- docker push $IMAGE_PRD
after_script:
- git config --global --unset https.proxy
- git config --global --unset http.proxy
- echo "" >/home/gitlab-runner/.gitconfig
retry: 2
deploy-prd:
image: portainer/kubectl-shell
stage: deploy-prd
tags:
- linux-shell
only:
- tags
script:
- echo $KUBE_CONFIG_MASA_YDY | 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
when: manual