2020的最后一天,不妨了解下装饰器 #123
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
name: 部署博客 | |
env: | |
# hexo源文件仓库 | |
BLOG_SOURCE: flytam/blog-source | |
# issue链接 | |
ISSUE_URL: https://github.com/flytam/blog/issues | |
# blog部署的页面 | |
BLOG: flytam/blog | |
# ${{ github.event.issue.user.login }} | |
on: | |
issues: | |
types: [opened, edited] | |
push: | |
branches: | |
- 'master' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# 仓库作者才才能触发 | |
if: ${{ github.actor == github.repository_owner }} | |
steps: | |
- name: 拉取hexo源文件 | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: 'false' | |
repository: ${{ env.BLOG_SOURCE }} | |
ref: 'main' | |
token: ${{ secrets.token }} | |
- name: issue生成 hexo文章 | |
uses: flytam/github-issue-to-hexo@main | |
with: | |
issue_url: ${{ env.ISSUE_URL }} | |
output: 'source/_posts' | |
replace: true | |
- name: commit hexo源文件 | |
run: | | |
echo $(date) > update.md | |
git add . | |
git config user.name "issue-to-hexo bot" | |
git config user.email "[email protected]" | |
git commit -m "Add a post" | |
- name: 推送hexo源文件 | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.token }} | |
repository: ${{ env.BLOG_SOURCE }} |