如何通过其他操作触发gh-pages分支更改

时间:2020-06-20 13:11:24

标签: github-actions

我获得了成功发布到gh页的操作:

>=

我添加了第二个动作

name: Deployment
on:
    push:
        branches:
            - master
jobs:
    deploy:
        runs-on: ubuntu-latest
        strategy:
            matrix:
                node-version: [12.x]
        steps:
            - uses: actions/checkout@v1
            - name: Use Node.js ${{ matrix.node-version }}
              uses: actions/setup-node@v1
              with:
                  node-version: ${{ matrix.node-version }}
            - name: Install Packages
              run: npm install
            - name: Build page
              run: npm run build
            - name: Deploy to gh-pages
              uses: peaceiris/actions-gh-pages@v3
              with:
                  deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
                  publish_dir: ./build

...但是它永远不会触发enter image description here

1 个答案:

答案 0 :(得分:0)

我们还可以将.github目录(包括第二个工作流程)放入gh-pages分支。

- name: Deploy
  uses: peaceiris/actions-gh-pages@v3
  with:
    deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} # Recommended
    personal_token: ${{ secrets.PERSONAL_TOKEN }} # An alternative
    # github_token: ${{ secrets.GITHUB_TOKEN }}   # Dot not use this token for this case.
    exclude_assets: ''

exclude_assets目录设置为空,以将.github目录包括在部署资产中。

有关更多详细信息,请参见最新的自述文件:How to trigger gh-pages branch changes via another action - Stack Overflow