2020-03-06 11:22:32

This commit is contained in:
monlor
2020-03-06 11:22:32 +08:00
parent 6e6f315ae0
commit 312db7f2f5
3 changed files with 78 additions and 11 deletions

View File

@@ -1,10 +1,70 @@
image: lholota/bash-git image: lholota/bash-git
stages: stages:
- pack
- deploy - deploy
deploy: pack:
stage: deploy stage: pack
only:
- master
- test
- dev
script: script:
- bash -e ./tools/gitsync.sh pack - bash -e ./tools/gitsync.sh pack
deploy-gitlab:
stage: deploy
only:
- master
- test
- dev
script:
- bash -e ./tools/gitsync.sh deploy mbfiles ${CI_COMMIT_REF_NAME} ${GL_REF}/monlor/mbfiles.git - bash -e ./tools/gitsync.sh deploy mbfiles ${CI_COMMIT_REF_NAME} ${GL_REF}/monlor/mbfiles.git
deploy-coding:
stage: deploy
only:
- master
- test
script:
- bash -e ./tools/gitsync.sh deploy mbfiles ${CI_COMMIT_REF_NAME} ${CO_REF}/monlor/mbfiles.git
pack-all:
stage: pack
only:
- tags
tags:
- deploy-*
script:
- git fetch origin master
- git checkout master
- bash -e ./tools/gitsync.sh pack mbfiles-master
- git fetch origin test
- git checkout test
- bash -e ./tools/gitsync.sh pack mbfiles-test
deploy-all:
stage: deploy
only:
- tags
tags:
- deploy-*
script:
- bash -e ./tools/gitsync.sh deploy mbfiles-master ${CI_COMMIT_REF_NAME} ${CO_REF}/monlor/mbfiles.git
- bash -e ./tools/gitsync.sh deploy mbfiles-test ${CI_COMMIT_REF_NAME} ${CO_REF}/monlor/mbfiles.git
cache:
key: ${CI_COMMIT_REF_NAME}
untracked: true
paths:
- mbfiles/
cache:
key: deploy-all
untracked: true
paths:
- mbfiles-master/
- mbfiles-test/

View File

@@ -40,7 +40,7 @@ base_encode() {
if [ -z "${1}" ]; then if [ -z "${1}" ]; then
echo -n "" echo -n ""
else else
if command -v base64-encode &> /dev/null; then if base64-encode &> /dev/null; then
echo -n "$*" | base64-encode echo -n "$*" | base64-encode
else else
echo -n "$*" | baseutil --b64 echo -n "$*" | baseutil --b64
@@ -52,7 +52,7 @@ base_decode() {
if [ -z "${1}" ]; then if [ -z "${1}" ]; then
echo -n "" echo -n ""
else else
if command -v base64-decode &> /dev/null; then if base64-decode &> /dev/null; then
echo -n "$*" | base64-decode echo -n "$*" | base64-decode
else else
echo -n "$*" | baseutil --b64 -d echo -n "$*" | baseutil --b64 -d

View File

@@ -59,22 +59,29 @@ gerneral_applist() {
pack() { pack() {
local pack_dir="${1:-mbfiles}"
rm -rf appstore/ rm -rf appstore/
rm -rf mbfiles/
echo "开始打包插件..." echo "开始打包插件..."
mkdir appstore mkdir appstore
ls apps/ | while read line; do ls apps/ | while read line; do
# 取用缓存数据
if [ -f ${pack_dir}/applist.txt ]; then
version_old=`cat ${pack_dir}/applist.txt | grep "$line|" | cut -d'|' -f4`
version_new=`cat apps/$line/config/$line.uci | grep "version=" | cut -d'=' -f2 | sed -e 's/"//g'`
[ "$version_new" = "$version_old" ] && echo "$line未更新,跳过打包..." && continue
fi
pack_app $line pack_app $line
done done
gerneral_applist gerneral_applist
mkdir mbfiles mkdir -p ${pack_dir}/appstore 2> /dev/null
cp -rf appsbin/ mbfiles/appsbin/ cp -rf appsbin/ ${pack_dir}/appsbin/
cp -rf temp/ mbfiles/temp/ cp -rf temp/ ${pack_dir}/temp/
cp -rf install.sh mbfiles/ cp -rf install.sh ${pack_dir}/
mv -f appstore/ mbfiles/appstore/ mv -f appstore/* ${pack_dir}/appstore/
mv -f applist.txt mbfiles/ mv -f applist.txt ${pack_dir}/
} }