Skip to content

Commit

Permalink
[Debug] Add auto build
Browse files Browse the repository at this point in the history
  • Loading branch information
Lhcfl committed Nov 30, 2023
1 parent 18d251b commit b741d34
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
49 changes: 31 additions & 18 deletions .github/workflows/build_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,35 @@ jobs:
- run: npm install
- run: npm run build

# - name: Configure Git # 配置Git
# env:
# DEPLOY_PRI: ${{ secrets.DEPLOY_PRI }}
# GIT_USERNAME: Bot
# GIT_EMAIL: ${{ github.repository_owner }}@user.github.com
# run: |
# sudo timedatectl set-timezone "Asia/Shanghai"
# mkdir -p ~/.ssh/
# echo "$DEPLOY_PRI" > ~/.ssh/id_rsa
# chmod 600 ~/.ssh/id_rsa
# ssh-keyscan github.com >> ~/.ssh/known_hosts
# git config --global user.name '$DEPLOY_PRI'
# git config --global user.email '$DEPLOY_PRI'
- name: Configure Git # 配置Git
env:
DEPLOY_PRI: ${{secrets.DEPLOY_PRI}} # 这里就是刚刚配置的私钥了
GIT_USERNAME: ${{ github.repository_owner }} #Github用户名,这里用了Actions自带的变量,也可以写死。
GIT_EMAIL: ${{ github.repository_owner }}@user.github.com # 邮箱,可以写自己的邮箱。
run: |
sudo timedatectl set-timezone "Asia/Shanghai"
mkdir -p ~/.ssh/
echo "$DEPLOY_PRI" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
git config --global user.name '$DEPLOY_PRI'
git config --global user.email '$DEPLOY_PRI'
# - name: Update package-lock.json
# run: |
# git add package-lock.json
# git commit -m "Auto Update package-lock" --no-verify
# git push origin main
- name: Commit Build # 提交文档到Git仓库
env:
GIT_URL: '[email protected]:Lhcfl/Linquebot_v2.git' # 项目的地址,注意要用SSH格式的。
run: |
cp package.json dist/
cp package-lock.json dist/
cp README.md dist/
cd dist
git init
git remote add origin $GIT_URL
git checkout -b build
git add -A
git commit -m "BUILD generated."
- name: Push Build # 推送
run: |
cd dist
git push origin HEAD:build --force
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"dev": "cd src && ts-node-esm index.ts",
"start": "cd dist && node index.js",
"run": "node index.js",
"preview": "npm run build && npm run start",
"build": "tsc && tsc-alias",
"watch": "sh -c '(tsc-alias -w&); tsc -w'",
Expand Down

0 comments on commit b741d34

Please sign in to comment.