docusaurus: Github Actions deployment error
🐛 Bug Report
(A clear and concise description of what the bug is) Following the guidelines of GitHub Actions deployment here: https://v2.docusaurus.io/docs/deployment/#deploy The actions fail to build and deploy the site with this error:
Release to GitHub Pages5s
##[error]Process completed with exit code 1.
Run git config --global user.email "actions@gihub.com"
npm ERR! cipm can only install packages with an existing package-lock.json or npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or later to generate it, then try again.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2020-05-30T17_04_14_260Z-debug.log
##[error]Process completed with exit code 1.
To Reproduce
- Added contents of
documentation.ymlfrom https://v2.docusaurus.io/docs/deployment/#deploy to file.github/workflows/documentation.ymlindocumentationbranch of repository - Followed the instructions to generate/deploy ssh key and secret
Expected behavior
successfully build the site and deploy to branch gh-pages
Actual Behavior
The actions fail to build and deploy the site with this error:
Release to GitHub Pages5s
##[error]Process completed with exit code 1.
Run git config --global user.email "actions@gihub.com"
npm ERR! cipm can only install packages with an existing package-lock.json or npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or later to generate it, then try again.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2020-05-30T17_04_14_260Z-debug.log
##[error]Process completed with exit code 1.
Your Environment
- Docusaurus version used: 2.0.0-alpha.56
- Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node v14.2.0
- Operating system and version (desktop or mobile): Desktop Arch Linux
Reproducible Demo
https://github.com/pdimens/PopGen.jl/tree/documentation/.github/workflows
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 20 (8 by maintainers)
This an example github action that I am using to deploy to gh pages with
peaceiris/actions-gh-pages. This action works fine without a new deploy ssh key.@anshulrgoyal to follow up, I tried to see if it would make a difference to set up an SSH key for
actions@github.comrather than the email account associated with my github account, and that seemed to do the trick. I pushed a minor commit and GitHub Actions finally ran the job successfully. If what I did was the the correct method all along, I recommend adding the specificity in the docusaurus deploy docs of creating an SSH key foractions@github.com.It wouldn’t work if u have passcode on ssh key
Hey,
Using NPM ?
If you don’t have a package-lock.json file, do you use npm locally?
If yes, have you run
npm installlocally?Since npm5, all npm installs normally create a package-lock.json file. Maybe you should upgrade to npm5 if you are using an older version (there are options to create a package-lock.json for older versions afaik)
Have you committed this lockfile? you should.
Using Yarn ?
Then you have a
yarn.lock, and it would be better to use yarn in the CI to be sure to use the same versions in dev and CI (those in the lockfile)So you should replace all NPM commands by yarn equivalent
yarn install --frozen-lockfile, according to https://stackoverflow.com/questions/58482655/what-is-the-closest-to-npm-ci-in-yarnso when you see:
You can replace by:
Don’t forget to install yarn in the Github CI first: https://codyogden.blog/yarn-with-github-actions-ci-cd/