第二是两个job之间的文件不能够直接用,又翻了下文档才发现官方给了这两个 actions/upload-artifact@v2 actions/download-artifact@v2 可以在不同job之间公用文件,所以又改了改,build阶段上传打包好的文件,deploy阶段下载打包好的文件进行部署(注意deploy也要使用checkout@v2)。
name:Webpage Deployon:push:branches:-mainjobs:web-deploy:name:Deployruns-on:ubuntu-lateststeps:-name:Get Latest Codeuses:actions/checkout@v3-name:Use Node.jsuses:actions/setup-node@v3with:node-version:'16.20.2'-name:Build Projectrun:|npm installCI=false npm run build- name: Sync filesuses...
npm run deploy 访问:https://wangzhe3224.github.io/react-todo/ 路径的格式为 https://{github用户名}.http://github.io/{仓库名}/ 未解决的问题(Sloved) github部署以后总是会从新定向到https://wangzhe3224.github.io/new-item而不是https://wangzhe3224.github.io/react-todo/new-item。感觉还是routing...
过程 现在你有一个create-react-app创建的react项目 npm create-react-app 想要部署到github pages上。 修改package.json { "name": "your\_proj\_name", "version": "0.1.0", "private": true, "homepage": "./", ... }, "scripts": { ... + "predeploy": "npm run build" , + "deploy":...
"build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "predeploy": "yarn build", "deploy": "gh-pages -b master -d build" }, "homepage": "https://<username>.github.io/<project>", ...
Creat React App deploy on GitHub 在将本地的react项目部署到GitHub上时,除了官方文档上介绍的那几步外,可能还会出现下面的两个错误。 Failed to get remote.origin.url (task must either be run in a git repository with a configured origin remote or must be configured with the “repo” option)....
01. Create a vite react app npm create vite@latest 02. Set the base onvite.config base:"/[REPO_NAME]/"; 03. Create ./github/workflows/deploy.yml and add the code bellow name:Deployon:push:branches: -mainjobs:build:name:Buildruns-on:ubuntu-lateststeps: -name:Checkout repouses:actions...
// 本地项目可以随便命名,这里以github-pages为例 create-react-app github-pages 安装一个名为gh-pages的依赖; $ cd github-pages $ npm install gh-pages --save-dev 打开package.json,在scripts项中增加推送部署配置 "scripts": { //... "predeploy": "npm run build", "deploy": "gh-pages -d ...
运行npm run deploy命令将应用程序部署到GitHub页面。 如果你遇到了问题,可以尝试以下解决方案: 确保你的React应用程序没有任何错误或警告。在开发过程中,可以使用浏览器的开发者工具来检查错误和警告信息。 检查你的GitHub仓库的设置是否正确,并确保你有足够的权限来进行部署。 检查你的网络连...
Deploy React App to GitHub Pages In order to use GitHub Pages, you'll have to install it first: npminstallgh-pages gh-pageswill allow you to create thegh-pagesbranch where you'll deploy your code. Next, go to yourpackage.jsonfile and add the homepage which will be the home URL of ...