都 2020 年了,你还在手动发布 npm 包吗 #137
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 "test@github.com" | |
git commit -m "Add a post" | |
- name: 推送hexo源文件 | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.token }} | |
repository: ${{ env.BLOG_SOURCE }} |