Run the action from a different directory
See original GitHub issueHi,
I am trying to use this Github Actions to push a VuePress website from a source
branch to a master
branch.
The website is generated using a regular npm run build
script and the build outputs to ./docs/.vuepress/dist
.
./
here is the root of my repo.
I would like to only push files inside of this directory to the master
, not the whole path.
The problem is that currently the action is running git add
from the root folder, instead of running it from .docs/.vuepress/dist
… resulting in having the full path pushed to the master
branch.
As for now Github Actions working-directory
can’t be used in addition with the uses
command, it would be nice to have a directory
option to tell the action where to run the git add
command.
Here is my worflow:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
(...)
- name: Commit changes
uses: EndBug/add-and-commit@master
with:
branch: "master"
add: "docs/.vuepress/dist --force"
message: "Deploy docs"
Here is a workflow we could have:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
(...)
- name: Commit changes
uses: EndBug/add-and-commit@master
with:
branch: "master"
directory: "docs/.vuepress/dist" <--- the action will run "cd [directory]" command before running
add: ". --force"
message: "Deploy docs"
You can have a look at the current VuePress deploy script here: https://vuepress.vuejs.org/guide/deploy.html#github-pages
Thanks for your feedback! 😉
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top GitHub Comments
Fine, I will choose the more appropriate option. Thanks for the fast answers/support anyway!
I am closing the issue 😉
The Vue docs say to navigate to that directory only because they’re creating a new repo and then pushing to a custom URL, which my action doesn’t currently support.
This are your options:
cwd
option to make it run on that repo.gh-pages
(which is what I would do), to directly publish the dist folder to your branch (you can edit the name of the branch it uses)In any of these three ways, there are no changes needed for the action.