Skip to content

Commit 2d77ea8

Browse files
committed
Added GH Actions deploy
1 parent f473d05 commit 2d77ea8

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/gh-deploy.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# REF: Inspired from:
2+
# https://dev.to/achukka/deploy-react-app-using-github-actions-157d
3+
# https://github.com/jlumbroso/hugo-geekdoc-github-example/blob/47d86ed41e1678c13b17c44a71140563c8882f3c/.github/workflows/gh-pages.yaml
4+
5+
name: Deploy React Application to GitHub Pages
6+
7+
# Controls when the action will run.
8+
on:
9+
# Triggers the workflow on push or pull request events but only for the main branch
10+
push:
11+
branches: [main]
12+
pull_request:
13+
branches: [main]
14+
15+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
16+
jobs:
17+
deploy:
18+
# The type of runner that the job will run on
19+
runs-on: ubuntu-latest
20+
21+
strategy:
22+
matrix:
23+
node-version: [12.x] # We will deploy with only one version of node
24+
25+
# Steps represent a sequence of tasks that will be executed as part of the job
26+
steps:
27+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
28+
- uses: actions/checkout@v2
29+
with:
30+
submodules: true # Fetch recursive submodules (true OR recursive)
31+
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
32+
33+
- name: Use Node.js ${{ matrix.node-version }}
34+
uses: actions/setup-node@v2
35+
with:
36+
node-version: ${{ matrix.node-version }}
37+
38+
- name: npm ci, build and test
39+
run: |
40+
npm ci
41+
npm run build --if-present
42+
npm test
43+
44+
- name: Deploy to gh-pages
45+
uses: peaceiris/actions-gh-pages@v3
46+
with:
47+
github_token: ${{ secrets.GITHUB_TOKEN }}
48+
publish_branch: gh-pages
49+
publish_dir: ./build

0 commit comments

Comments
 (0)