# 项目自动化构建发布

测试环境前端h5代码自动化发布

```bash
#!/bin/bash
#/data/tg-test/dev_capital_test.sh 
API="https://api.telegram.org/bot5035739927:AAEoN_prxkaWf7aapWH0Lgi5T8deAt4Ailk" #飞机机器人API
GID="chat_id=-747209743"                                                         #飞机机器人群ID
MSG="${API}/sendMessage?${GID}&text="                                            #发送文本方法
SF="$API/sendDocument?$GID -F document=@"                                        #发送文件方法

cd /data/tg-test/capital
gitinfo=`git log -1 | grep commit | awk '{print $2}'`
zip -q -r $gitinfo.capital.dev.zip /data/tg-test/capital/
mv $gitinfo.capital.dev.zip ../
cd /data/tg-test/
rm -rf /data/tg-test/capital                                                     ;curl $MSG"代码备份成功capital测试环境"

git clone -b test-stock http://账号:密码@git地址/root/capital.git    ;curl $MSG"代码拉取中capital测试环境"
cd /data/tg-test/capital
git pull                                                                         ;curl $MSG"代码拉取成功capital测试环境"
#echo "前端h5不需要构建"                                                         ;curl $MSG"代码构建成功capital测试环境"

echo ok                                                                          ;curl $MSG"代码发布成功capital测试环境"

echo "显示本次git版本信息"     
curl -s -o /dev/null -X POST "https://api.telegram.org/bot5035739927:AAEoN_prxkaWf7aapWH0Lgi5T8deAt4Ailk/sendMessage" -d chat_id="-747209743" -d text="`git log -1`"
```

测试环境后端php代码自动化发布

```bash
API="https://api.telegram.org/bot5035739927:AAEoN_prxkaWf7aapWH0Lgi5T8deAt4Ailk" #飞机机器人API
GID="chat_id=-747209743"                                                         #飞机机器人群ID
MSG="${API}/sendMessage?${GID}&text="                                            #发送文本方法
SF="$API/sendDocument?$GID -F document=@"                                        #发送文件方法

cd /data/tg-test/stock/

gitinfo=`git log -1 | grep commit | awk '{print $2}'`
zip -q -r $gitinfo.capital.dev.zip /data/tg-test/stock/            ;curl $MSG"代码备份成功stock测试环境"
mv $gitinfo.capital.dev.zip ../
git branch --set-upstream-to=origin/test test                                    ;curl $MSG"代码切换test分支"
git pull                                                                         ;curl $MSG"代码拉取成功stock测试环境"
cd /data/tg-test/stock/                                                          ;curl $MSG"代码构建中stock测试环境"
echo y | composer install                                                        ;curl $MSG"代码构建成功stock测试环境"
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan config:clear

echo ok                                                                          ;curl $MSG"代码发布成功stock测试环境"

echo "显示本次git版本信息"     
curl -s -o /dev/null -X POST "https://api.telegram.org/bot5035739927:AAEoN_prxkaWf7aapWH0Lgi5T8deAt4Ailk/sendMessage" -d chat_id="-747209743" -d text="`git log -1`"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xn--6o0a585a.gitbook.io/devops/zi-dong-hua/xiang-mu-zi-dong-hua-gou-jian-fa-bu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
