-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
42 lines (36 loc) · 1.42 KB
/
.gitlab-ci.yml
File metadata and controls
42 lines (36 loc) · 1.42 KB
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
variables:
#打包格式
FORMAT: tar.gz
#打包所用的分支或者标签:origin/master表示打包主分支,
Branch_or_Tag: origin/master
#生成tar的名称
TAR_NAME: lubancat_rk_code_storage_
#NAS地址 数量不匹配需要删改PDF-files任务中的内容
NAS_URL1: /mnt/百度云对外发布资料/Linux产品线/鲁班猫_瑞芯微系列/1-野火开源图书_教程文档/配套代码/综合代码
#NAS_URL2:
stages: # 分段
- pack
code-pack:
tags:
- ENABLE
stage: pack
# when: manual
script:
- now="`date +%Y%m%d`"
- apt update && apt install -y tar ca-certificates
# 打包
- git submodule update --init --recursive
- git submodule foreach 'git pull origin master'
- tar czf $TAR_NAME$now.$FORMAT *
#网盘同步,在不同的仓库中都需要修改
#注意:只在NAS_URL1中使用 -print > ;后面的地址使用 -print >>
#
#NAS_URL1
# 获取要延时删除的zip包列表
# - find "$NAS_URL1" -path "$NAS_URL1/$TAR_NAME$now.$FORMAT" -prune -o -type f -name "*.$FORMAT" -print > /root/autodelate/temp/$ZIP_NAME$now.log
- rm -rf $NAS_URL1/$TAR_NAME*.$FORMAT
# 复制新的压缩包
- cp -f $TAR_NAME$now.$FORMAT "$NAS_URL1"
#NAS_URL2
#- find "$NAS_URL2" -path "$NAS_URL2/$ZIP_NAME$now.$FORMAT" -prune -o -type f -name "*.$FORMAT" -print >> /root/autodelate/temp/$ZIP_NAME$now.log
#- cp -f $ZIP_NAME$now.$FORMAT "$NAS_URL2"