You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you run this command from a CI/CD environment, the deployment will most likely not work out of the box.
170
-
For security reasons, those environments usually have read-only privileges or you haven't set up Git correctly.
171
-
Therefore you should take a look at ["personal access tokens" `GH_TOKEN`](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) (which works everywhere) and the ["installation access token" `GITHUB_TOKEN`](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token) (which is exclusively provided by GitHub actions).
171
+
For security reasons, those environments usually have read-only privileges, or you haven't set up Git correctly.
172
+
Therefore, you should take a look at ["personal access tokens" `GH_TOKEN`](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) (which works everywhere) and the ["installation access token" `GITHUB_TOKEN`](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token) (which is exclusively provided by GitHub actions).
172
173
In short: a token replaces username and password and is a safer choice because a token can be revoked at any time.
173
174
174
175
All you need to do is to set an environment variable called `GH_TOKEN` (or `PERSONAL_TOKEN`) in your CI/CD environment.
@@ -201,7 +202,7 @@ ng deploy --repo=https://github.com/<username>/<repositoryname>.git --name="Your
201
202
-`ng deploy` – The tag `<base href="/">` remains unchanged in your `index.html`
202
203
-`ng deploy --base-href=/the-repositoryname/` – The tag `<base href="/the-repositoryname/">` is added to your `index.html`
203
204
204
-
Specifies the base URL for the application being built.
205
+
Specify the base URL for the application being built.
205
206
Same as `ng build --base-href=/XXX/`
206
207
207
208
**ℹ️ Please read the next lines carefully, or you will get 404 errors in case of a wrong configuration!**
@@ -266,7 +267,7 @@ ng deploy --build-target=test
266
267
-`ng deploy` – Angular project is build in production mode before the deployment
267
268
-`ng deploy --no-build` – Angular project is NOT build
268
269
269
-
Skip build process during deployment.
270
+
Skip the build process during deployment.
270
271
This can be used when you are sure that you haven't changed anything and want to deploy with the latest artifact.
271
272
This command causes the `--build-target` setting to have no effect.
272
273
@@ -280,7 +281,7 @@ This specifies the target repository. If none is given as an option, the reposit
280
281
281
282
By default, this command assumes that the current working directory is a Git repository,
282
283
and that you want to push changes to the `origin` remote.
283
-
If instead your files are not in a git repository, or if you want to push to another repository,
284
+
If instead, your files are not in a git repository, or if you want to push to another repository,
284
285
you can provide the repository URL in the `repo` option.
285
286
286
287
> **ℹ️ Hint**
@@ -340,8 +341,9 @@ With `--no-dotfiles` files starting with `.` are ignored.
340
341
-`ng deploy` – A `404.html` file is created by default.
341
342
-`ng deploy --no-notfound` – No `404.html` file is created.
342
343
343
-
By default a `404.html` file is created, because this is the only known workaround to avoid 404 error messages on GitHub Pages.
344
-
For Cloudflare Pages we highly recommend to disable the `404.html` file by setting this switch to true! see [#178](https://github.com/angular-schule/angular-cli-ghpages/issues/178)
344
+
By default, a `404.html` file is created, because this is the only known workaround to avoid 404 error messages on GitHub Pages.
345
+
For Cloudflare Pages we highly recommend to disable the `404.html` file by setting this switch to true!
346
+
See [#178](https://github.com/angular-schule/angular-cli-ghpages/issues/178)
345
347
346
348
#### --no-nojekyll <aname="no-nojekyll"></a>
347
349
@@ -351,7 +353,7 @@ For Cloudflare Pages we highly recommend to disable the `404.html` file by setti
351
353
-`ng deploy` – A `.nojekyll` file is created by default.
352
354
-`ng deploy --no-nojekyll` – No `.nojekyll` file is created.
353
355
354
-
By default a `.nojekyll` file is created, because we assume you don't want to compile the build again with Jekyll.
356
+
By default, a `.nojekyll` file is created, because we assume you don't want to compile the build again with Jekyll.
355
357
356
358
**Explanation:**
357
359
By creating such a file in the root of your pages repo, you will bypass the Jekyll static site generator on GitHub Pages.
@@ -370,6 +372,17 @@ The same applies to `.txt` files in your assets folder: They will just disappear
370
372
A CNAME file will be created enabling you to use a custom domain.
371
373
[More information on GitHub Pages using a custom domain](https://help.github.com/articles/using-a-custom-domain-with-github-pages/).
372
374
375
+
#### --add <aname="add"></a>
376
+
377
+
-**optional**
378
+
- Default: `false` (boolean) – The existing files will be removed from the branch you'll be pushing to as expected.
379
+
- Example:
380
+
-`ng deploy --add=true`
381
+
382
+
If is set to `true`, it will only add, and never remove existing files.
383
+
By default, existing files in the target branch are removed before adding the ones.
Copy file name to clipboardExpand all lines: docs/README_standalone.md
+15-4Lines changed: 15 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# angular-cli-ghpages: README for the standalone program
2
2
3
-
In the past this project was a standalone program.
3
+
In the past, this project was a standalone program.
4
4
This is still possible.
5
5
6
6
## Installation & Setup
@@ -85,7 +85,7 @@ Output the version number. Please provide the version number on any bug report!
85
85
86
86
By default, **gh-pages** assumes that the current working directory is a git repository,
87
87
and that you want to push changes to the `origin` remote.
88
-
If instead your files are not in a git repository, or if you want to push to another repository,
88
+
If instead, your files are not in a git repository, or if you want to push to another repository,
89
89
you can provide the repository URL in the `repo` option.
90
90
91
91
#### --message <a name="message"></a>
@@ -125,7 +125,7 @@ In this case provide both `name` and `email` string values to identify the commi
125
125
- Default: `dist`
126
126
127
127
Directory for all published sources, relative to the current working directory.
128
-
**Starting with Angular CLI 6 the build artifacts will be put in a subfolder under `dist`.
128
+
**Starting with Angular CLI 6, the build artifacts will be put in a subfolder under `dist`.
129
129
Please take a look at the `dist` folder to see whether there is a subfolder with your project's name or not.**
130
130
131
131
This option can be used to deploy completely different folders,
@@ -139,7 +139,7 @@ which are not related at all to angular.
139
139
- `npx angular-cli-ghpages` -- Dotfiles are included by default.
140
140
- `npx angular-cli-ghpages --no-dotfiles` -- Dotfiles are ignored.
141
141
142
-
The command includes dotfiles by default (e.g `.htaccess` will be committed)
142
+
The command includes dotfiles by default (e.g.`.htaccess` will be committed)
143
143
With `--no-dotfiles` files starting with `.` are ignored.
144
144
145
145
#### --dry-run <a name="dry-run"></a>
@@ -161,6 +161,17 @@ Run through without making any changes. This can be very usefull, because it out
161
161
162
162
A CNAME file will be created enabling you to use a custom domain. [More information on Github Pages using a custom domain](https://help.github.com/articles/using-a-custom-domain-with-github-pages/).
163
163
164
+
#### --add <a name="add"></a>
165
+
166
+
- **optional**
167
+
- Default: `false` (boolean) – The existing files will be removed from the branch you'll be pushing to as expected.
168
+
- Example:
169
+
- `npx angular-cli-ghpages --add=true`
170
+
171
+
If is set to `true`, it will only add, and never remove existing files.
172
+
By default, existing files in the target branch are removed before adding the ones.
Copy file name to clipboardExpand all lines: src/engine/engine.ts
+21-20Lines changed: 21 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
import{logging}from'@angular-devkit/core';
1
+
import{logging}from'@angular-devkit/core';
2
2
import*asfsefrom'fs-extra';
3
3
import*aspathfrom'path';
4
4
5
-
import{Schema}from'../deploy/schema';
6
-
import{GHPages}from'../interfaces';
7
-
import{defaults}from'./defaults';
5
+
import{Schema}from'../deploy/schema';
6
+
import{GHPages}from'../interfaces';
7
+
import{defaults}from'./defaults';
8
8
9
9
importGitfrom'gh-pages/lib/git';
10
10
@@ -293,22 +293,23 @@ async function publishViaGhPages(
293
293
if(options.dryRun){
294
294
logger.info(
295
295
`Dry-run / SKIPPED: publishing folder '${dir}' with the following options: `+
296
-
JSON.stringify(
297
-
{
298
-
dir,
299
-
repo: options.repo||'current working directory (which must be a git repo in this case) will be used to commit & push',
300
-
message: options.message,
301
-
branch: options.branch,
302
-
name: options.name ? `the name '${options.username} will be used for the commit` : 'local or global git user name will be used for the commit',
303
-
email: options.email ? `the email '${options.cname} will be used for the commit` : 'local or global git user email will be used for the commit',
304
-
dotfiles: options.dotfiles ? `files starting with dot ('.') will be included` : `files starting with dot ('.') will be ignored`,
305
-
notfound: options.notfound ? 'a 404.html file will be created' : 'a 404.html file will NOT be created',
306
-
nojekyll: options.nojekyll ? 'a .nojekyll file will be created' : 'a .nojekyll file will NOT be created',
307
-
cname: options.cname ? `a CNAME file with the content '${options.cname}' will be created` : 'a CNAME file will NOT be created'
308
-
},
309
-
null,
310
-
' '
311
-
)
296
+
JSON.stringify(
297
+
{
298
+
dir,
299
+
repo: options.repo||'current working directory (which must be a git repo in this case) will be used to commit & push',
300
+
message: options.message,
301
+
branch: options.branch,
302
+
name: options.name ? `the name '${options.username} will be used for the commit` : 'local or global git user name will be used for the commit',
303
+
email: options.email ? `the email '${options.cname} will be used for the commit` : 'local or global git user email will be used for the commit',
304
+
dotfiles: options.dotfiles ? `files starting with dot ('.') will be included` : `files starting with dot ('.') will be ignored`,
305
+
notfound: options.notfound ? 'a 404.html file will be created' : 'a 404.html file will NOT be created',
306
+
nojekyll: options.nojekyll ? 'a .nojekyll file will be created' : 'a .nojekyll file will NOT be created',
307
+
cname: options.cname ? `a CNAME file with the content '${options.cname}' will be created` : 'a CNAME file will NOT be created',
308
+
add: options.add ? 'all files will be added to the branch. Existing files will not be removed' : 'existing files will be removed from the branch before adding the new ones',
0 commit comments