Skip to content

Commit

Permalink
feat: 新增机器人判别测试
Browse files Browse the repository at this point in the history
  • Loading branch information
HardenSG committed Mar 2, 2024
1 parent db7dbdc commit 8b8b52c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: build weapp ci
on:
# 监听PUSH和PR
push:
branches: [ main ]
branches: [ main, pre ]
pull_request:
branches: [ main ]

Expand Down
20 changes: 20 additions & 0 deletions scripts/uploadDist/upload.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
const path = require('path')
const ci = require('miniprogram-ci')
const { execSync } = require('child_process')

const cwd = process.cwd()
const { version } = require(path.resolve(cwd + '/package.json'))
const now = new Date().toLocaleDateString();

const ROBOT_MAP = {
'pre': 2,
'main': 3
}

const getCurrentBranch = () => execSync('git branch --show-current').toString().trim()
const getTargetRobotId = () => ROBOT_MAP[getCurrentBranch()]

const upload = async () => {
const robot = getTargetRobotId()
console.log('当前分支:' + getCurrentBranch() + ' 机器人编号为:' + robot);
if (!robot) {
console.log('您当前不在能够上传产物的白名单分支,请切换到指定分支并重新构建产物');
return
}

const project = new ci.Project({
appid: 'wx6836fb3c447f8868',
type: 'miniProgram',
Expand All @@ -19,9 +35,13 @@ const upload = async () => {
desc: now + ' 提交版本 v: ' + version,
setting: {
es6: true,
minify: true,
autoPrefixWXSS: true
},
robot,
onProgressUpdate: console.log,
})
console.log(uploadResult)
}
upload()

2 changes: 1 addition & 1 deletion src/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default defineAppConfig({
navigationBarBackgroundColor: '#fff',
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'black',
enablePullDownRefresh: true,
enablePullDownRefresh: false,
},
// 自定义TabBar使用
tabBar: {
Expand Down
4 changes: 4 additions & 0 deletions src/pages/Index/index.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export default definePageConfig({
navigationBarTitleText: '当我在追光~',
enablePullDownRefresh: true,
navigationStyle: 'custom',
enableShareAppMessage: true,
enableShareTimeline: true
})
5 changes: 5 additions & 0 deletions src/pages/Index/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.index_wrapper {
width: 750rpx;
height: 100vh;
background-color: #fff;
}
2 changes: 1 addition & 1 deletion src/pages/Index/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Index = () => {
const state = useSelector((state1: RootState) => state1.common)

return (
<View className='index'>
<View className='index_wrapper'>
<Text>Hello world1212121!-- {state.age}</Text>
<Button onClick={() => Taro.navigateTo({ url: URL.Detail + `?id=${12}` })}>去详细界面</Button>
</View>
Expand Down

0 comments on commit 8b8b52c

Please sign in to comment.