48 lines (45 loc) · 1.32 KB
/
pull-request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Test and deploy staging version to surge
on:
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'npm'
- name: Install all packages
working-directory: ./sharetopia-frontend
run: npm ci
- name: Run unit tests
working-directory: ./sharetopia-frontend
run: npm run test:unit
build_and_deploy:
runs-on: ubuntu-latest
name: build and deploy (staging)
needs: test
steps:
- uses: actions/checkout@v1
- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'npm'
- name: Install all packages
working-directory: ./sharetopia-frontend
run: npm ci
- name: Run build
working-directory: ./sharetopia-frontend
run: npm run build
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: save build to dist
path: ./sharetopia-frontend/dist
# deploy to surge
- run: npm install -g surge
- run: surge ./sharetopia-frontend/dist ${{ secrets.SURGE_DOMAIN }} --token ${{ secrets.SURGE_TOKEN }}