web/.github/workflows/deploy.yml

56 lines
1.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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提醒已有提交推送到仓库请留意构建结果。"