-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
58 lines (57 loc) · 2.24 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
# This is a sample GitLab CI/CD configuration file that should run without any modifications.
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
# it uses echo commands to simulate the pipeline execution.
#
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.
#
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
variables:
REMOTE_ACTION_SH: |
cd /www/wwwroot/approve.mxte.cc/
tar -zxvf production.tar.gz -C ./
rm -rf ./production.tar.gz
default:
image: node:boron
cache:
key: node-cache
paths:
- node_module/
- production.tar.gz
- build/
stages: # List of stages for jobs, and their order of execution
- build
- deploy
build-job: # This job runs in the build stage, which runs first.
stage: build
script:
- echo 安装最新版node
- npm cache clean -f
- npm install -g n
- n stable
- node -v
- yarn config set registry https://registry.npmmirror.com/
- yarn
- CI=false yarn build
- ls
- tar -zcvf production.tar.gz build
deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
script:
- mkdir -p ~/.ssh && chmod 700 ~/.ssh/
- echo "$PRIVATE_KEY" >> ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- scp -v -r -o ServerAliveInterval=15 -o ServerAliveCountMax=3 -P 2333 ./production.tar.gz root@$PROD_ENV:/www/wwwroot/approve.mxte.cc/
- ssh root@$PROD_ENV -p 2333 "$REMOTE_ACTION_SH"
# Install the cli
- curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION="2.2.0" bash
# Setup configuration values
- export SENTRY_AUTH_TOKEN=$SENTRY_TOKEN
- export SENTRY_ORG=njuptf2e
- export SENTRY_PROJECT=approve-system
- export VERSION=`sentry-cli releases propose-version`
# Workflow to create releases
- sentry-cli releases new "$VERSION"
- sentry-cli releases set-commits "$VERSION" --auto
- sentry-cli releases finalize "$VERSION"
- sentry-cli releases files "$VERSION" upload-sourcemaps /build/static/js