Update about me #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: CD | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# 为了防止被刷爆,隐藏更新地址并设置一个token在环境变量中,接口处也校验一下 | |
steps: | |
- name: Notify server of project updates | |
run: | | |
RES=$(curl -d 'event=update-hexo-blog&token=${{ secrets.UPDATE_HEXO_BLOG_TOKEN }}' -X POST https://yuanbo.online/${{ secrets.UPDATE_HEXO_BLOG_PATH }}) | |
code=$(echo $RES | perl -pe 's/.*?"code":(\d+).+/\1/six') | |
echo "code: $code" | |
if [ "$code" -eq "0" ]; then | |
echo "success" | |
else | |
echo "publish failed, res: ${RES}" | |
exit 1 | |
fi |