Skip to content

Commit 536df36

Browse files
authored
Merge pull request #30 from niyazm524/feature/ci
Настройка CI
2 parents c1955ed + d407b43 commit 536df36

File tree

5 files changed

+150
-1
lines changed

5 files changed

+150
-1
lines changed

.firebaserc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"projects": {
3+
"default": "github-client-47c49"
4+
}
5+
}

.github/workflows/dev.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This workflow will install node dependencies, build the source code and run tests
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Dev CI/CD
5+
6+
on:
7+
push:
8+
branches: [ dev ]
9+
pull_request:
10+
branches: [ dev ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
node-version: [12.x]
20+
21+
steps:
22+
- name: Checkout Repository
23+
uses: actions/checkout@v2
24+
25+
- name: Setup Node.js ${{ matrix.node-version }}
26+
uses: actions/setup-node@v1
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
30+
- name: Cache node modules
31+
uses: actions/cache@v2
32+
with:
33+
path: ~/.npm
34+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
35+
restore-keys: |
36+
${{ runner.os }}-node-
37+
38+
- name: Install dependencies
39+
run: npm install
40+
41+
- name: Run Tests
42+
run: npm run test
43+
44+
- name: Build
45+
run: npm run build
46+
47+
- name: Deploy
48+
uses: peaceiris/actions-gh-pages@v3
49+
with:
50+
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
51+
publish_dir: ./build
52+
if: ${{ github.event_name == 'push' }}

.github/workflows/prod.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Production CI/CD
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
node-version: [12.x]
20+
21+
steps:
22+
- name: Checkout Repository
23+
uses: actions/checkout@v2
24+
25+
- name: Setup Node.js ${{ matrix.node-version }}
26+
uses: actions/setup-node@v1
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
30+
- name: Cache node modules
31+
uses: actions/cache@v2
32+
with:
33+
path: ~/.npm
34+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
35+
restore-keys: |
36+
${{ runner.os }}-node-
37+
38+
- name: Install dependencies
39+
run: npm install
40+
41+
- name: Run Tests
42+
run: npm run test
43+
env:
44+
CI: true
45+
46+
- name: Build
47+
run: npm run build
48+
49+
- name: Archive Production Artifact
50+
uses: actions/upload-artifact@v2
51+
with:
52+
name: build
53+
path: build
54+
55+
deploy:
56+
name: Deploy
57+
needs: build
58+
if: ${{ github.event_name == 'push' }}
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Checkout Repo
62+
uses: actions/checkout@master
63+
64+
- name: Download Artifact
65+
uses: actions/download-artifact@main
66+
with:
67+
name: build
68+
path: build
69+
70+
- name: Deploy to Firebase
71+
uses: w9jds/firebase-action@master
72+
with:
73+
args: deploy --only hosting
74+
env:
75+
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

firebase.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"hosting": {
3+
"public": "build",
4+
"ignore": [
5+
"firebase.json",
6+
"**/.*",
7+
"**/node_modules/**"
8+
],
9+
"rewrites": [
10+
{
11+
"source": "**",
12+
"destination": "/index.html"
13+
}
14+
]
15+
}
16+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,6 @@
7979
"eslint --max-warnings=10 --fix",
8080
"git add"
8181
]
82-
}
82+
},
83+
"homepage": "/github-client"
8384
}

0 commit comments

Comments
 (0)