56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
name: 自动部署
|
||
|
||
on:
|
||
push:
|
||
branches: [ master ]
|
||
|
||
jobs:
|
||
build:
|
||
runs-on: ubuntu-latest
|
||
|
||
permissions:
|
||
contents: write
|
||
|
||
steps:
|
||
- name: 克隆代码
|
||
uses: actions/checkout@v2
|
||
|
||
- name: 构建产物
|
||
run: |
|
||
npm install
|
||
npm run build
|
||
|
||
- name: 部署分支
|
||
run: |
|
||
cd dist
|
||
git config --global user.name "juetan"
|
||
git config --global user.email "810335188@qq.com"
|
||
git init
|
||
git add -A
|
||
git commit -m "Build through github action"
|
||
git push -f "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" master:gh-pages
|
||
|
||
send:
|
||
runs-on: ubuntu-latest
|
||
|
||
steps:
|
||
- name: 克隆代码
|
||
uses: actions/checkout@v2
|
||
|
||
- name: 构建消息
|
||
id: exec_cmd
|
||
run: |
|
||
MSG=$(git log --format=%B -n 1 ${{ github.sha }})
|
||
echo "msg=$MSG" >> "$GITHUB_OUTPUT"
|
||
HASH=$(git log -1 --pretty=format:%h)
|
||
echo "hash1=$HASH" >> "$GITHUB_ENV"
|
||
shell: bash
|
||
|
||
- name: 推送到企微
|
||
uses: appnify/action-wechat-work@master
|
||
env:
|
||
WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
|
||
with:
|
||
msgtype: text
|
||
content: "推送通知\n\n仓库名称:${{ github.repository }}\n提交用户:${{ github.actor }}\n提交消息:${{ steps.exec_cmd.outputs.msg }}\n提交哈希:${{ env.hash1 }}\n\n提醒:已有提交推送到仓库,请留意构建结果。"
|