mirror of
https://github.com/monlor/MIXBOX-ARCHIVE.git
synced 2026-03-10 23:41:27 +00:00
更新ci
This commit is contained in:
37
.github/workflows/main.yml
vendored
37
.github/workflows/main.yml
vendored
@@ -1,37 +1,22 @@
|
||||
name: CI
|
||||
name: Main-CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Pack files
|
||||
run: |
|
||||
git lfs pull
|
||||
mkdir appstore/
|
||||
mkdir mbfiles/
|
||||
bash ./tools/gitsync.sh pack all
|
||||
cp -rf appsbin/ mbfiles/appsbin/
|
||||
cp -rf appstore/ mbfiles/appstore/
|
||||
cp -rf temp/ mbfiles/temp/
|
||||
cp -rf applist.txt mbfiles/
|
||||
cp -rf install.sh mbfiles/
|
||||
- name: Push changes
|
||||
env:
|
||||
GH_REF: ${{ secrets.GH_REF }}
|
||||
CO_REF: ${{ secrets.CO_REF }}
|
||||
BRANCH_NAME: $(cd .. && git branch | awk '$1 == "*"{print $2}')
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Deploy
|
||||
env:
|
||||
GH_REF: ${{ secrets.GH_REF }}
|
||||
CO_REF: ${{ secrets.CO_REF }}
|
||||
run: |
|
||||
cd mbfiles/
|
||||
git init
|
||||
git config --local user.email "monlor@qq.com"
|
||||
git config --local user.name "monlor"
|
||||
git add .
|
||||
git commit -m "$(TZ='Asia/Shanghai' date "+%Y-%m-%d %H:%M:%S")" -a
|
||||
eval "git push "${GH_REF}" master:"${BRANCH_NAME}" -f"
|
||||
eval "git push "${CO_REF}" master:"${BRANCH_NAME}" -f"
|
||||
bash ./tools/gitsync.sh pack
|
||||
bash ./tools/gitsync.sh deploy mbfiles `git branch | awk '$1 == "*"{print $2}'` ${GH_REF}
|
||||
bash ./tools/gitsync.sh deploy mbfiles `git branch | awk '$1 == "*"{print $2}'` ${CO_REF}
|
||||
55
.github/workflows/master.yml
vendored
55
.github/workflows/master.yml
vendored
@@ -1,55 +0,0 @@
|
||||
name: Master-CI
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
branches:
|
||||
- 'master1'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
branches:
|
||||
- 'master1'
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Pack files
|
||||
run: |
|
||||
mkdir appstore/
|
||||
mkdir mbfiles/
|
||||
bash ./tools/gitsync.sh pack all
|
||||
cp -rf appsbin/ mbfiles/appsbin/
|
||||
cp -rf appstore/ mbfiles/appstore/
|
||||
cp -rf temp/ mbfiles/temp/
|
||||
cp -rf applist.txt mbfiles/
|
||||
cp -rf install.sh mbfiles/
|
||||
|
||||
- name: Push to Github
|
||||
env:
|
||||
GH_REF: github.com/monlor/mbfiles
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
run: |
|
||||
cd mbfiles/
|
||||
git init
|
||||
git config --local user.email "monlor@qq.com"
|
||||
git config --local user.name "monlor"
|
||||
git add .
|
||||
git commit -m "$(TZ='Asia/Shanghai' date "+%Y-%m-%d %H:%M:%S")" -a
|
||||
git push "https://${GH_TOKEN}@${GH_REF}" master:master -f
|
||||
|
||||
- name: Push to Gitee
|
||||
uses: s0/git-publish-subdir-action@master
|
||||
env:
|
||||
REPO: git@gitee.com:monlor/mbfiles.git
|
||||
BRANCH: master
|
||||
FOLDER: mbfiles
|
||||
SSH_PRIVATE_KEY: ${{ secrets.GE_TOKEN }}
|
||||
KNOWN_HOSTS_FILE: temp/known_hosts # Needed if target repo is not on github.com
|
||||
|
||||
|
||||
40
.github/workflows/tag.yaml
vendored
Normal file
40
.github/workflows/tag.yaml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
name: Tag-CI
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- deploy-*
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Deploy Master
|
||||
env:
|
||||
BRANCH_NAME: master
|
||||
run: |
|
||||
git checkout ${BRANCH_NAME}
|
||||
bash ./tools/gitsync.sh pack
|
||||
bash ./tools/gitsync.sh deploy mbfiles ${BRANCH_NAME} ${GH_REF}
|
||||
bash ./tools/gitsync.sh deploy mbfiles ${BRANCH_NAME} ${CO_REF}
|
||||
|
||||
- name: Deploy Test
|
||||
env:
|
||||
BRANCH_NAME: test
|
||||
run: |
|
||||
git checkout ${BRANCH_NAME}
|
||||
bash ./tools/gitsync.sh pack
|
||||
bash ./tools/gitsync.sh deploy mbfiles ${BRANCH_NAME} ${GH_REF}
|
||||
bash ./tools/gitsync.sh deploy mbfiles ${BRANCH_NAME} ${CO_REF}
|
||||
|
||||
- name: Deploy Dev
|
||||
env:
|
||||
BRANCH_NAME: dev
|
||||
run: |
|
||||
git checkout ${BRANCH_NAME}
|
||||
bash ./tools/gitsync.sh pack
|
||||
bash ./tools/gitsync.sh deploy mbfiles ${BRANCH_NAME} ${GH_REF}
|
||||
bash ./tools/gitsync.sh deploy mbfiles ${BRANCH_NAME} ${CO_REF}
|
||||
55
.github/workflows/test.yaml
vendored
55
.github/workflows/test.yaml
vendored
@@ -1,55 +0,0 @@
|
||||
name: Test-CI
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
branches:
|
||||
- 'test1'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
branches:
|
||||
- 'test1'
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Pack files
|
||||
run: |
|
||||
mkdir appstore/
|
||||
mkdir mbfiles/
|
||||
bash ./tools/gitsync.sh pack all
|
||||
cp -rf appsbin/ mbfiles/appsbin/
|
||||
cp -rf appstore/ mbfiles/appstore/
|
||||
cp -rf temp/ mbfiles/temp/
|
||||
cp -rf applist.txt mbfiles/
|
||||
cp -rf install.sh mbfiles/
|
||||
|
||||
- name: Push to Github
|
||||
env:
|
||||
GH_REF: github.com/monlor/mbfiles
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
run: |
|
||||
cd mbfiles/
|
||||
git init
|
||||
git config --local user.email "monlor@qq.com"
|
||||
git config --local user.name "monlor"
|
||||
git add .
|
||||
git commit -m "$(TZ='Asia/Shanghai' date "+%Y-%m-%d %H:%M:%S")" -a
|
||||
git push "https://${GH_TOKEN}@${GH_REF}" master:test -f
|
||||
|
||||
- name: Push to Gitee
|
||||
uses: s0/git-publish-subdir-action@master
|
||||
env:
|
||||
REPO: git@gitee.com:monlor/mbfiles.git
|
||||
BRANCH: test
|
||||
FOLDER: mbfiles
|
||||
SSH_PRIVATE_KEY: ${{ secrets.GE_TOKEN }}
|
||||
KNOWN_HOSTS_FILE: temp/known_hosts # Needed if target repo is not on github.com
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
#### 一键安装
|
||||
|
||||
``` shell
|
||||
sh -c "$(curl -kfsSl https://gitee.com/monlor/mbfiles/raw/master/install.sh)" && source /etc/profile &> /dev/null
|
||||
sh -c "$(curl -kfsSl https://monlor.coding.net/p/mbfiles/d/mbfiles/git/raw/master/install.sh)" && source /etc/profile &> /dev/null
|
||||
```
|
||||
|
||||
### 手动更新命令
|
||||
@@ -100,7 +100,7 @@ sh -c "$(curl -kfsSl https://raw.githubusercontent.com/monlor/MIXBOX/master/apps
|
||||
#### 卸载`Monlor Tools`工具箱
|
||||
|
||||
``` shell
|
||||
sh -c "$(curl -kfsSl https://gitee.com/monlor/mbfiles/raw/master/temp/uninstall_old.sh)" && source /etc/profile &> /dev/null
|
||||
sh -c "$(curl -kfsSl https://monlor.coding.net/p/mbfiles/d/mbfiles/git/raw/master/temp/uninstall_old.sh)" && source /etc/profile &> /dev/null
|
||||
```
|
||||
|
||||
#### 一键更新所有插件(请先更新工具箱)
|
||||
|
||||
@@ -9,8 +9,6 @@ find . -name '._*' | xargs rm -rf
|
||||
|
||||
github_url="https://github.com/monlor/MIXBOX.git"
|
||||
github_raw="https://raw.githubusercontent.com/MIXBOX/master"
|
||||
coding_url="git@e.coding.net:monlor/MIXBOX.git"
|
||||
coding_raw="https://monlor.coding.net/p/MIXBOX/d/MIXBOX/git/raw/master"
|
||||
|
||||
sedsh() {
|
||||
[ -z "$1" -o -z "$2" -o -z "$3" ] && echo "null sedsh params!" && exit 1
|
||||
@@ -29,30 +27,6 @@ sedsh() {
|
||||
fi
|
||||
}
|
||||
|
||||
version() {
|
||||
local appname="$1"
|
||||
eval `cat apps/${appname}/config/${appname}.uci | grep version`
|
||||
[ -z "$version" ] && echo "版本号读取失败!" && exit 1
|
||||
# sed -i $args '/version/d' apps/${appname}/config/${appname}.uci
|
||||
sedsh "d" "version" "apps/${appname}/config/${appname}.uci"
|
||||
num1=$(echo "$version" | cut -d'.' -f1)
|
||||
num2=$(echo "$version" | cut -d'.' -f2)
|
||||
num3=$(echo "$version" | cut -d'.' -f3)
|
||||
if [ "$num3" -eq '9' ]; then
|
||||
if [[ "$num2" -eq '9' ]]; then
|
||||
let num1=$num1+1
|
||||
num2=0
|
||||
num3=0
|
||||
else
|
||||
let num2=$num2+1
|
||||
num3=0
|
||||
fi
|
||||
else
|
||||
let num3=$num3+1
|
||||
fi
|
||||
echo "version=\"$num1.$num2.$num3\"" >> apps/${appname}/config/${appname}.uci
|
||||
}
|
||||
|
||||
pack_app() {
|
||||
local appname=$1
|
||||
rm -rf pack/
|
||||
@@ -87,21 +61,22 @@ gerneral_applist() {
|
||||
|
||||
pack() {
|
||||
|
||||
case "$1" in
|
||||
all )
|
||||
rm -rf appstore/
|
||||
rm -rf mbfiles/
|
||||
|
||||
mkdir appstore
|
||||
ls apps/ | while read line; do
|
||||
[ "$2" = "-v" ] && version ${line}
|
||||
pack_app $line
|
||||
done
|
||||
;;
|
||||
* )
|
||||
[ -z "$1" ] && echo "未输入插件名!" && exit
|
||||
[ "$2" = "-v" ] && version $1
|
||||
pack_app $1
|
||||
;;
|
||||
esac
|
||||
gerneral_applist
|
||||
|
||||
mkdir mbfiles
|
||||
cp -rf appsbin/ mbfiles/appsbin/
|
||||
cp -rf temp/ mbfiles/temp/
|
||||
cp -rf install.sh mbfiles/
|
||||
mv -f appstore/ mbfiles/appstore/
|
||||
mv -f applist.txt mbfiles/
|
||||
|
||||
}
|
||||
|
||||
localgit() {
|
||||
@@ -111,23 +86,9 @@ localgit() {
|
||||
|
||||
github() {
|
||||
|
||||
# sed -i $args "s#^mburl.*#mburl=\"$github_raw\"#" ./install.sh
|
||||
# sedsh "s" "^mburl.*" "mburl=\"$github_raw\"" "./install.sh"
|
||||
# git remote rm origin
|
||||
# git remote add origin $github_url
|
||||
git push $github_url $1:$1
|
||||
}
|
||||
|
||||
coding() {
|
||||
|
||||
# sed -i $args "s#^mburl.*#mburl=\"$coding_raw\"#" ./install.sh
|
||||
# sedsh "s" "^mburl.*" "mburl=\"$coding_raw\"" "./install.sh"
|
||||
git remote rm origin
|
||||
git remote add origin $coding_url
|
||||
git push origin $1
|
||||
|
||||
}
|
||||
|
||||
reset() {
|
||||
|
||||
git checkout --orphan latest_branch
|
||||
@@ -136,27 +97,36 @@ reset() {
|
||||
git branch -D master
|
||||
git branch -m master
|
||||
|
||||
# git push -f origin master
|
||||
# github
|
||||
# coding
|
||||
git rm -r --cached .
|
||||
}
|
||||
|
||||
# $1: path to push
|
||||
# $2: remote branch name
|
||||
# $3: remote url with token
|
||||
# $4: git extra param
|
||||
deploy() {
|
||||
|
||||
cd $1
|
||||
git init
|
||||
git config --local user.email "monlor@qq.com"
|
||||
git config --local user.name "monlor"
|
||||
git add .
|
||||
git commit -m "$(TZ='Asia/Shanghai' date "+%Y-%m-%d %H:%M:%S")" -a
|
||||
git push "$3" master:"$2" -f "$4"
|
||||
git push "$3" master:"$2" -f "$4"
|
||||
|
||||
}
|
||||
|
||||
case $1 in
|
||||
github)
|
||||
github master
|
||||
;;
|
||||
# coding)
|
||||
# localgit
|
||||
# coding master
|
||||
# ;;
|
||||
localgit)
|
||||
localgit
|
||||
;;
|
||||
push)
|
||||
git status && localgit
|
||||
github $2
|
||||
# coding $1
|
||||
;;
|
||||
pack)
|
||||
shift 1
|
||||
@@ -165,4 +135,6 @@ case $1 in
|
||||
reset)
|
||||
reset master
|
||||
;;
|
||||
deploy)
|
||||
deploy $@
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user