Skip to content

Commit 01c70a9

Browse files
authored
ci: fix github pages integration (#66)
1 parent 0925312 commit 01c70a9

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

.github/workflows/deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
uses: ./.github/actions/nodejs
1414

1515
- name: Build demo
16-
run: npm run build
16+
run: npx nx build-gh-pages
1717

1818
- name: Deploy
1919
uses: JamesIves/github-pages-deploy-action@v4.2.5

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
1414
1. Run `npm ci` to install everything
1515

16-
2. Change `npmScope` inside `nx.json`
16+
2. Use search to replace all mentions of `angular-open-source-starter` with your new library name (`npmScope` inside
17+
`nx.json`, matadata of the root `package.json`, root `README.md` etc.)
1718

1819
3. Create basic file structure via [Nx-generators](https://nx.dev/plugin-features/use-code-generators):
1920

projects/demo/project.json

+16-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"build": {
99
"executor": "@angular-devkit/build-angular:browser",
1010
"options": {
11+
"baseHref": "/",
12+
"deployUrl": "/",
1113
"outputPath": "dist/demo/browser",
1214
"index": "projects/demo/src/index.html",
1315
"main": "projects/demo/src/main.browser.ts",
@@ -26,8 +28,6 @@
2628
},
2729
"configurations": {
2830
"production": {
29-
"baseHref": "./",
30-
"deployUrl": "./",
3131
"fileReplacements": [
3232
{
3333
"replace": "projects/demo/src/environments/environment.ts",
@@ -50,12 +50,23 @@
5050
}
5151
]
5252
},
53-
"development": {
54-
"baseHref": "/"
55-
}
53+
"development": {}
5654
},
5755
"defaultConfiguration": "production"
5856
},
57+
"build-gh-pages": {
58+
"executor": "@nrwl/workspace:run-commands",
59+
"options": {
60+
"parallel": false,
61+
"commands": [
62+
"echo 'Github pages require special baseHref + 404.html'",
63+
"echo 'Read more: https://angular.io/guide/deployment#deploy-to-github-pages'",
64+
"echo ------",
65+
"nx build --base-href='/angular-open-source-starter/'",
66+
"cp dist/demo/browser/index.html dist/demo/browser/404.html"
67+
]
68+
}
69+
},
5970
"serve": {
6071
"executor": "@angular-devkit/build-angular:dev-server",
6172
"options": {

0 commit comments

Comments
 (0)