Open Alwinator opened 2 years ago
I think it could be fixed by rebuilding because then npm installs the latest Caprover CLI which fixed the bug.
Hi, got exactly the same issue. Deployment to caprover fails.
Some npm warning from previous step Build AlexxNB/caprover-action@v1
could they be involved ?
I used a workaround, it might not be as fast, but it always uses the latest version. Replace the action:
- name: Caprover Deploy
uses: AlexxNB/caprover-action@v1
with:
server: 'https://example.com'
password: '${{ secrets.CAPROVER_PASSWORD }}'
appname: 'myapp'
branch: 'main'
With the following code that installs the Caprover CLI in the pipeline and deploys your app.
- name: Set up npm
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install caprover
run: npm install -g caprover
- name: Caprover Deploy
run: caprover deploy -h 'https://example.com' -p '${{ secrets.CAPROVER_PASSWORD }}' -b 'main' -a 'myapp'
Works fine! Not that slow, thanks!
After a little investigation, the bug is caused by this line. The problem is that the Github checkout action only pulls the latest hash which causes an issue with git rev-list
. It can be fixed by adding fetch-depth: 0
, see git-rev-list-not-working-inside-github-action. For some reason, it also works when using Ubuntu instead of Alpine, but that makes it even slower.
uses: actions/checkout@v2
with:
fetch-depth: 0
I realized after benchmarking that installing the Caprover CLI in the pipeline as mentioned in my comment before is a much better solution than using this action because it only takes 13 seconds. This action takes 28 seconds and it is already based on alpine, so it cannot be improved a lot.
- name: Set up npm
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install caprover
run: npm install -g caprover
- name: Caprover Deploy
run: caprover deploy -h 'https://example.com' -p '${{ secrets.CAPROVER_PASSWORD }}' -b 'main' -a 'myapp'
Thanks @Alwinator !
After two days of trial and error and trying above methods, I couldn't get to work. Finnaly found solution, actually you would need to checkout to the branch that is referenced.
- name: Checkout to branch
run: |
git fetch origin ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
econd solution (without action):
- name: Set up npm uses: actions/setup-node@v2 with: node-version: '14'
Thank you for your instructions, I followed it and it worked. Really thanks
You caprover action worked great for month, but for one week it does not work with the following exception: