11name : Sync Posts To Repo Blog
22
33on :
4+ workflow_dispatch :
45 push :
56 branches :
67 - master
@@ -47,10 +48,12 @@ jobs:
4748 # 上传构建产物
4849 - name : Upload artifacts
4950 # 链接 https://github.com/actions/upload-artifact/
50- uses : actions/upload-artifact@v4.3.0
51+ uses : actions/upload-artifact@v4
5152 with :
5253 name : _posts
5354 path : public
55+ include-hidden-files : true
56+ if-no-files-found : error
5457
5558 # 设置为两个串行作业,个人认为这两个作业没必要完全绑成一个作业,为了不相互干扰和影响
5659 sync :
@@ -62,10 +65,10 @@ jobs:
6265 # 下载构建产物
6366 - name : Download artifact
6467 # 链接 https://github.com/actions/download-artifact
65- uses : actions/download-artifact@v4.0.0
68+ uses : actions/download-artifact@v4
6669 with :
6770 name : _posts
68- path : dist
71+ path : public
6972
7073 # 创建 repo blog 的目录
7174 - name : Create directory for repo blog
8689 run : |
8790
8891 rm -rf blog/source/_posts/*
89- cp -r dist /* blog/source/_posts/
92+ cp -r public /* blog/source/_posts/
9093 cd blog/
9194
9295 git config user.name "github-actions[bot]"
9598 git add source/_posts/
9699 git commit -m "Sync posts from repo https://github.com/DavidingPlus/study-notes"
97100 git push -u origin master
98-
99- # 触发 blog 的 CI
100- # 本来是通过 blog 的 _posts 分支进行中转的,但是 github 不允许连续两次触发 push 的 action,为了防止死循环,因此需要走手动 Trigger 的流程。现在直接一步到位,因此这一步骤注释。
101- # - name: Trigger action in branch master
102- # # 链接 https://github.com/convictional/trigger-workflow-and-wait
103- # uses: convictional/[email protected] 104- # with:
105- # owner: DavidingPlus
106- # repo: blog
107- # github_user: DavidingPlus
108- # workflow_file_name: build.yml
109- # ref: master
110- # github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
0 commit comments