File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ name: React App Deployment # name of the workflo
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - deploy-react-app # branch name
7
+
8
+ jobs:
9
+ deploy-react-to-gh-pages:
10
+ runs-on: ubuntu-latest
11
+ env:
12
+ EXAMPLE: example # environment variable
13
+ defaults:
14
+ run:
15
+ working-directory: ./react-deployment-example
16
+ steps:
17
+ # checkout the repository content to github runner
18
+ - name: Checkout
19
+ uses: actions/checkout@v2
20
+
21
+ # setup nodejs environment
22
+ - name: Setup Node.js environment
23
+
24
+ with:
25
+ node-version: "18.16.1"
26
+
27
+ # cache the dependencies to speed up the build
28
+ - name: Cache dependencies
29
+ uses: actions/cache@v2
30
+ with:
31
+ path: ~/.npm
32
+ key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
33
+ restore-keys: |
34
+ ${{ runner.os }}-node-
35
+
36
+ # install dependencies
37
+ - name: Install dependencies
38
+ run: npm i
39
+
40
+ # build the react app
41
+ - name: Build
42
+ run: npm run build
43
+
44
+ # deploy the react app to github pages
45
+ - name: Deploy
46
+ uses: peaceiris/actions-gh-pages@v3
47
+ with:
48
+ # NOTE: GITHUB_TOKEN is a secret token that is automatically generated by GitHub
49
+ github_token: ${{ secrets.GITHUB_TOKEN }}
50
+ publish_dir: ./build # directory to deploy
You can’t perform that action at this time.
0 commit comments