Skip to content

Commit

Permalink
增加 Github Actions 脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
zoujingli committed Aug 2, 2024
0 parents commit ce7375c
Show file tree
Hide file tree
Showing 719 changed files with 74,292 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.js linguist-language=php
*.css linguist-language=php
*.html linguist-language=php
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Release
permissions: write-all

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
27 changes: 27 additions & 0 deletions .github/workflows/split.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Split Repos

on: [ workflow_dispatch ]

jobs:
split:
if: github.repository == 'zoujingli/think-admin-developer'
runs-on: ubuntu-latest
env:
SSH_PRIVATE_KEY: ${{ secrets.SPLIT_PRIVATE_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Private Key
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "StrictHostKeyChecking no" >> ~/.ssh/config
- name: Split And Push
run: |
git config pull.rebase true
git config --global user.name "Anyon"
git config --global user.email "[email protected]"
./bin/split-linux.sh
49 changes: 49 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.env
.git
.svn
.idea
.fleet
.vscode
.DS_Store

/vendor
/runtime
/safefile
/nbproject
/composer.lock
!composer.json

### 屏蔽环境文件
/404.html
/.user.ini
/index.html
/public/upload
/public/404.html
/public/.htaccess
/public/.user.ini
/public/index.html
/public/favicon.ico
/database/sqlite.db

### 屏蔽插件文件
/app/admin
/app/wechat

### 屏蔽配置文件
/config/app.php
/config/cookie.php
/config/lang.php
/config/log.php
/config/route.php
/config/session.php
/config/view.php

/public/static/plugs
/public/static/theme
/public/static/admin.js
/public/static/login.js

### 屏蔽数据库脚本
/database/migrations/*_install_*.php
!database/migrations/*_install_*_table.php
!database/migrations/*_install_package.php
27 changes: 27 additions & 0 deletions app/index/controller/Index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

// +----------------------------------------------------------------------
// | Static Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// +----------------------------------------------------------------------
// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-static
// | github 代码仓库:https://github.com/zoujingli/think-plugs-static
// +----------------------------------------------------------------------

namespace app\index\controller;

use think\admin\Controller;

class Index extends Controller
{
public function index()
{
$this->redirect(sysuri('admin/login/index'));
}
}
54 changes: 54 additions & 0 deletions bin/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -e
if (( "$#" == 0 ))
then
echo "Tag has to be provided"
exit 1
fi

NOW=$(date +%s)
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
VERSION=$1
BASEPATH=$(cd `dirname $0`; cd ../plugin/; pwd)

# Always prepend with "v"
#if [[ $VERSION != v* ]]
#then
# VERSION="v$VERSION"
#fi

if [ -z $2 ] ; then
repos=$(ls $BASEPATH)
else
repos=${@:2}
fi

for REMOTE in $repos
do
echo ""
echo ""
echo "Cloning $REMOTE";
TMP_DIR="/tmp/ThinkAdminSplit"
REMOTE_URL="[email protected]:zoujingli/$REMOTE.git"

rm -rf $TMP_DIR;
mkdir $TMP_DIR;

(
cd $TMP_DIR;

git clone $REMOTE_URL .
git checkout "$CURRENT_BRANCH";

if [[ $(git log --pretty="%d" -n 1 | grep tag --count) -eq 0 ]]; then
echo "Releasing $REMOTE"
git tag $VERSION
echo "Git Push Origin --tags $VERSION"
# git push origin --tags
fi
)
done

TIME=$(echo "$(date +%s) - $NOW" | bc)

printf "Execution time: %f seconds" $TIME
27 changes: 27 additions & 0 deletions bin/split-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
set -x
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
BASEPATH=$(cd `dirname $0`; cd ../plugin/; pwd)
REPOS=$@
function split()
{
SHA1=`./bin/splitsh-lite-linux --prefix=$1`
git push $2 "$SHA1:refs/heads/$CURRENT_BRANCH" -f
}

function remote()
{
git remote add $1 $2 || true
}

git pull origin $CURRENT_BRANCH

if [[ $# -eq 0 ]]; then
REPOS=$(ls $BASEPATH)
fi

for REPO in $REPOS ; do
remote $REPO [email protected]:zoujingli/$REPO.git
split "plugin/$REPO" $REPO
done
30 changes: 30 additions & 0 deletions bin/split.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

set -e
set -x

CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
BASEPATH=$(cd `dirname $0`; cd ../plugin/; pwd)
REPOS=$@

function split()
{
SHA1=`./bin/splitsh-lite --prefix=$1`
git push $2 "$SHA1:refs/heads/$CURRENT_BRANCH" -f
}

function remote()
{
git remote add $1 $2 || true
}

git pull origin $CURRENT_BRANCH

if [[ $# -eq 0 ]]; then
REPOS=$(ls $BASEPATH)
fi

for REPO in $REPOS ; do
remote $REPO [email protected]:zoujingli/$REPO.git
split "plugin/$REPO" $REPO
done
Binary file added bin/splitsh-lite
Binary file not shown.
Binary file added bin/splitsh-lite-linux
Binary file not shown.
78 changes: 78 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"type": "project",
"name": "zoujingli/thinkadmin",
"license": "MIT",
"homepage": "https://thinkadmin.top",
"description": "Application Development Framework",
"keywords": [
"ThinkAdmin",
"ThinkLibrary",
"WeChatDeveloper"
],
"authors": [
{
"name": "Anyon",
"email": "[email protected]"
}
],
"require": {
"php": ">7.1",
"ext-gd": "*",
"ext-json": "*",
"ext-openssl": "*",
"zoujingli/think-plugs-wuma": "^1.0|@dev",
"zoujingli/think-plugs-admin": "^1.0|@dev",
"zoujingli/think-plugs-worker": "^1.0|@dev",
"zoujingli/think-plugs-center": "^1.0|@dev",
"zoujingli/think-plugs-wechat": "^1.0|@dev",
"zoujingli/think-plugs-wemall": "^1.0|@dev",
"zoujingli/think-plugs-account": "^1.0|@dev",
"zoujingli/think-plugs-payment": "^1.0|@dev",
"zoujingli/think-plugs-wechat-service": "^1.0|@dev"
},
"repositories": [
{
"type": "path",
"url": "plugin/think-plugs-wuma"
},
{
"type": "path",
"url": "plugin/think-plugs-worker"
},
{
"type": "path",
"url": "plugin/think-plugs-wechat"
},
{
"type": "path",
"url": "plugin/think-plugs-wechat-service"
},
{
"type": "path",
"url": "plugin/think-plugs-admin"
},
{
"type": "path",
"url": "plugin/think-plugs-center"
},
{
"type": "path",
"url": "plugin/think-plugs-account"
},
{
"type": "path",
"url": "plugin/think-plugs-payment"
},
{
"type": "path",
"url": "plugin/think-plugs-wemall"
}
],
"minimum-stability": "dev",
"config": {
"sort-packages": true,
"allow-plugins": {
"zoujingli/think-install": true
}
}
}
51 changes: 51 additions & 0 deletions config/cache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

// +----------------------------------------------------------------------
// | Static Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// +----------------------------------------------------------------------
// | gitee 代码仓库:https://gitee.com/zoujingli/think-plugs-static
// | github 代码仓库:https://github.com/zoujingli/think-plugs-static
// +----------------------------------------------------------------------

return [
// 默认缓存驱动
'default' => 'file',
// 缓存连接配置
'stores' => [
'file' => [
// 驱动方式
'type' => 'File',
// 缓存保存目录
'path' => '',
// 缓存名称前缀
'prefix' => '',
// 缓存有效期 0 表示永久缓存
'expire' => 0,
// 缓存标签前缀
'tag_prefix' => 'tag:',
// 序列化机制
'serialize' => [],
],
'safe' => [
// 驱动方式
'type' => 'File',
// 缓存保存目录
'path' => syspath('safefile/cache/'),
// 缓存名称前缀
'prefix' => '',
// 缓存有效期 0 表示永久缓存
'expire' => 0,
// 缓存标签前缀
'tag_prefix' => 'tag:',
// 序列化机制
'serialize' => [],
],
],
];
Loading

0 comments on commit ce7375c

Please sign in to comment.