Skip to content

Commit eb31dc5

Browse files
committed
Updated readme to describe repo's purpose
1 parent a1610c9 commit eb31dc5

File tree

1 file changed

+66
-1
lines changed

1 file changed

+66
-1
lines changed

README.md

+66-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,67 @@
11
# github-action-react-deployment
2-
This barebones project exists to demonstrate how to deploy a React app with GitHub Actions
2+
3+
This is based on the following tutorial:
4+
5+
> https://www.linkedin.com/pulse/automate-react-app-deployment-github-actions-elar-saks-/
6+
7+
The tutorial provides a simple GitHub Actions example for deploying a React App to `github.io`. The repository you are viewing now successfully delivers on that.
8+
9+
View the demo result here:
10+
11+
> https://codingkriggs.github.io/github-action-react-deployment/
12+
13+
You should see "`Edit src/App.js and save to reload.`", the recognizable boilerplate html that is found in that very file, `src/App.js`. This is how we know the code is hosted and React is working.
14+
15+
The tutorial is clear and self-explanatory. However I will draw your attention to differences I've added to this version.
16+
17+
---
18+
19+
## Differences
20+
21+
### Creation of a React project
22+
23+
The tutorial left this as an exercise and prerequisite to the tutorial.
24+
25+
First I created a git repo called `github-action-react-deployment` and hosted it on GitHub.
26+
27+
Within that repo's root directory, I issued the following terminal command to create a react project *as a subdirectory*:
28+
29+
* `npx create-react-app react-deployment-example --template minimal`
30+
31+
### Added support for monorepo design
32+
33+
You'll note that, unlike the tutorial, the react project itself is not at the root, but a subdirectory. I've done this to illustrate how to support multiple projects in a single repo, the so-called monorepo design.
34+
35+
In order to achieve this, the following changes were made compared to the tutorial:
36+
37+
* In `.github/workflows/deploy-react-app.yml`, under yaml's `jobs/deploy-react-to-gh-pages`, I added the following lines:
38+
39+
```yaml
40+
defaults:
41+
run:
42+
working-directory: ./react-deployment-example
43+
```
44+
45+
This does most actions (except `Deploy`) under that working directory.
46+
<br/>
47+
48+
* In the `Deploy` step, rather than
49+
50+
```yaml
51+
publish_dir: ./build
52+
```
53+
54+
I included the child directory:
55+
56+
```yaml
57+
publish_dir: ./react-deployment-example/build
58+
```
59+
<br/>
60+
61+
* The tutorials shows a URL that has the pattern `https://<githubuser>.github.io/react-deployment-example`, but the pattern for this monorepo should instead use the repo name, not the node package name, so `https://<githubuser>.github.io/git-action-react-deployment`.
62+
63+
---
64+
65+
## To summarize
66+
67+
With the changes mentioned above, the tutorial is now transformed to support the monorepo design, supporting multiple child directory packages and projects, even those not part of the NodeJS ecosystem.

0 commit comments

Comments
 (0)