I have a static website which is generating an output
folder to the MyBlog/output
in the master
branch. But I want output to be the source of my GH Pages, I am looking for a way to use output
as the root of gh-pages
branch.
That's my deploy.yml
name: Deploy Site
on:
push:
branches:
- master
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@master
with:
submodules: recursive
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.100'
- run: dotnet run --project "MyBlog" -- deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: git push
What should I do / add to my deploy.yml to do what I want please.
Thanks in advance.
Ok, this should work. Remove the last line - run: git push
from your action. Then add the following.
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./MyBlog/output
Finally your deploy.yml
should be:
name: Deploy Site
on:
push:
branches:
- master
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@master
with:
submodules: recursive
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.100'
- run: dotnet run --project "MyBlog" -- deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./MyBlog/output
I am assuming that MyBlog
is a folder present at root. Then this action will put the contents of your output
folder into the gh-pages
branch directly. I hope this is what you wanted to achieve.
In case you wish to know more, you can visit this