-
Notifications
You must be signed in to change notification settings - Fork 5
99 lines (88 loc) · 2.6 KB
/
on-push-or-pull.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: on-pull-request-or-push
on:
pull_request
env:
FIREBASE_CHANNEL: ${{ fromJSON('["", "live"]')[!github.base_ref] }}
CACHE_NODE_MODULES_PATH: |
node_modules
dist/valor-software-site
CACHE_DIST_PATH: |
dist
dist/valor-software-site
jobs:
# one run
one_run:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
# install dependencies
install:
runs-on: ubuntu-latest
needs: one_run
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.15.1'
- uses: actions/cache@v3
id: cache
with:
path: ${{ env.CACHE_NODE_MODULES_PATH }}
key: node_modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --immutable --immutable-cache --check-cache
if: steps.cache.outputs.cache-hit != 'true'
# build valor-software-site-base
build:
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.15.1'
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_NODE_MODULES_PATH }}
key: node_modules-${{ hashFiles('**/yarn.lock') }}
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_DIST_PATH }}
key: dist-${{ github.run_id }}
- run: npx nx run valor-software-site:build-scully -c stage
# run linting
linting:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_NODE_MODULES_PATH }}
key: node_modules-${{ hashFiles('**/yarn.lock') }}
- run: npm run lint
# firebase deploy preview
firebase_preview:
runs-on: ubuntu-latest
needs: build
outputs:
output_url: ${{ steps.firebase_hosting_preview.outputs.details_url }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_DIST_PATH }}
key: dist-${{ github.run_id }}
- uses: FirebaseExtended/action-hosting-deploy@v0
continue-on-error: true
id: firebase_hosting_preview
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_VALOR_SOFTWARE_SITE }}'
projectId: valor-software-site
target: development
expires: 7d
env:
FIREBASE_CLI_PREVIEWS: hostingchannels