0

我在一个名为 feat/demo-mode 的分支上对 Angular 存储库进行了许多更改,我想将此分支发布到 GitHub Pages。

在 GitHub Pages 部分下,我选择了我的分支,如下所示配置-a-publishing-source-for-your-github-pages-site

我在 package.json 中添加/更新了以下脚本

"build": "ng build --prod --base-href /my-example-repo/",
"predeploy": "npm run build",
"deploy": "npx angular-cli-ghpages --dir=dist/my-example-repo --branch=feat/demo-mode --message='Deploy to GitHub Pages'"

当我运行npm run deploy时,应用程序会构建和部署。我现在可以在 上访问它https://funfair-tech.github.io/my-example-repo/,但是 feat/demo-mode 中的代码现在已替换为我的 dist 文件夹的内容。

4

1 回答 1

0

所以我将我的包脚本更新为:

"build": "ng build --prod --base-href \"/funfair-client/\"",
"deploy": "npm run build && npx angular-cli-ghpages --dir dist/my-example-repo"

第一次运行后npm run deploy,我进入GitHub Pages,将发布源改为gh-pages。现在,当我在功能分支中进行更改时,我将更改推送到 git 然后npm run deploy再次运行。

于 2021-04-07T09:56:06.560 回答